Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant require('uuid') version 8.0.0 #433

Closed
lnogueir opened this issue May 2, 2020 · 5 comments
Closed

Cant require('uuid') version 8.0.0 #433

lnogueir opened this issue May 2, 2020 · 5 comments

Comments

@lnogueir
Copy link

lnogueir commented May 2, 2020

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

@lnogueir
Copy link
Author

lnogueir commented May 2, 2020

I did:
npm install uuid@7.0.0
and it works when i try to require, not sure if theres something wrong w/ version 8.0.0

@broofa
Copy link
Member

broofa commented May 2, 2020

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*]
+ uuid@8.0.0
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.

@lnogueir
Copy link
Author

lnogueir commented May 2, 2020

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.

@TrySound
Copy link
Member

TrySound commented May 3, 2020

@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

@TrySound
Copy link
Member

TrySound commented May 3, 2020

Duplicate of #428

@TrySound TrySound marked this as a duplicate of #428 May 3, 2020
@TrySound TrySound closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants