Uuid: Cant require('uuid') version 8.0.0

Created on 3 May 2020  路  5Comments  路  Source: uuidjs/uuid

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. (line i do require('uuid'))
at Module._compile (internal/modules/cjs/loader.js:1139:30) {
code: 'MODULE_NOT_FOUND'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1

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

All 5 comments

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.

Screen Shot 2020-05-02 at 7 16 02 PM

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

8bitjoey picture 8bitjoey  路  5Comments

ctavan picture ctavan  路  9Comments

danactive picture danactive  路  3Comments

dstaley picture dstaley  路  9Comments

ctavan picture ctavan  路  5Comments