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

tried to run uuid.v4() inside node CLI - TypeError ERR_INVALID_MODULE_SPECIFIER #506

Closed
gabrielxfs opened this issue Aug 11, 2020 · 1 comment

Comments

@gabrielxfs
Copy link

gabrielxfs commented Aug 11, 2020

Describe the bug

I tried to run uuid.v4() inside node CLI.

How to reproduce

Run node as CLI an type inside : const { v4: uuidv4 } = require('uuid') or require('uuid') .

Expected behavior

Get uuidv4() function to test then.

Runtime

  • OS: Arch Linux
  • Runtime: Node.js
  • Runtime Version: v14.6.0

Additional information

The bug inside node is :

> uuid = require('uuid')
Uncaught:
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "[~path~]/node_modules/uuid/dist/index.js" must not include encoded "/" or "\" characters imported from [~path~]/node_modules/uuid/
    at resolveExportsTarget (internal/modules/cjs/loader.js:564:15)
    at resolveExportsTarget (internal/modules/cjs/loader.js:601:20)
    at resolveExportsTarget (internal/modules/cjs/loader.js:601:20)
    at applyExports (internal/modules/cjs/loader.js:469:14)
    at resolveExports (internal/modules/cjs/loader.js:522:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:654:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1052:27)
    at Function.Module._load (internal/modules/cjs/loader.js:911:27)
    at Module.require (internal/modules/cjs/loader.js:1125:19)
    at require (internal/modules/cjs/helpers.js:75:18) {
  code: 'ERR_INVALID_MODULE_SPECIFIER
@broofa
Copy link
Member

broofa commented Aug 11, 2020

Looks like this is a bug in node@14.6. See also nodejs/node#34521

require('uuid') throws for me in the 14.6.0 REPL, but works in 14.0.0 and 14.8.0.

So... upgrade to latest 14.X build of node will be the quickest workaround.

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

2 participants