After npm install uuid
When trying to require('uuid') version 8.0.0 I get:
internal/modules/cjs/loader.js:625
throw e;
^
Error: No valid exports main found for 'pathtomyproject/node_modules/uuid'
at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.
at Module._compile (internal/modules/cjs/loader.js:1139:30) {
code: 'MODULE_NOT_FOUND'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
I did:
npm install [email protected]
and it works when i try to require, not sure if theres something wrong w/ version 8.0.0
Can you provide detailed recipe? For example, something like this...
$ mkdir foo
$ cd foo
$ nvm use 12
Now using node v12.10.0 (npm v6.13.6)
$ npm i uuid@latest
[*snip*]
+ [email protected]
added 1 package and audited 1 package in 0.452s
found 0 vulnerabilities
$ node -e "console.log(require('uuid'))"
{ v1: [Getter], v3: [Getter], v4: [Getter], v5: [Getter] }
Be sure to include your node version. Distill down to simplest possible example that shows your issue. Thanks.

I've tested it on another computer with node and npm versions 8.10.0 and 6.14.4, respectively, and I was able to require('uuid') fine, however, on mac it happens what's on the image above.
@lnogueir Please update your node version. 13.5 is very old with incomplete es modules support.
https://nodejs.org/docs/latest-v13.x/api/documentation.html
Duplicate of https://github.com/uuidjs/uuid/issues/428
Most helpful comment
@lnogueir Please update your node version. 13.5 is very old with incomplete es modules support.
https://nodejs.org/docs/latest-v13.x/api/documentation.html