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

what happen for this case #151

Open
liuseen-l opened this issue Mar 24, 2023 · 5 comments
Open

what happen for this case #151

liuseen-l opened this issue Mar 24, 2023 · 5 comments

Comments

@liuseen-l
Copy link

/usr/local/lib/node_modules/nrm/cli.js:9
const open = require('open');
^

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/nrm/node_modules/open/index.js from /usr/local/lib/node_modules/nrm/cli.js not supported.
Instead change the require of index.js in /usr/local/lib/node_modules/nrm/cli.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/usr/local/lib/node_modules/nrm/cli.js:9:14) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.15.0
C02F63FKMD6R:1.js bytedance$

@yixiaojiu
Copy link

I also encounted this error when I was using Node.js v19.8.1 and v18.12.1 😓

@halaproliu
Copy link

This is because nrm depend on a package called open.I got this error too yesterday!You can fix this error by use this command!npm install -g nrm [email protected] --save

@heeronchang
Copy link

/usr/local/lib/node_modules/nrm/cli.js:9 const open = require('open'); ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/nrm/node_modules/open/index.js from /usr/local/lib/node_modules/nrm/cli.js not supported. Instead change the require of index.js in /usr/local/lib/node_modules/nrm/cli.js to a dynamic import() which is available in all CommonJS modules. at Object. (/usr/local/lib/node_modules/nrm/cli.js:9:14) { code: 'ERR_REQUIRE_ESM' }

Node.js v18.15.0 C02F63FKMD6R:1.js bytedance$

Just change const open = require('open'); to const open = import('open'); at /usr/local/lib/node_modules/nrm/cli.js line 9.
It works for me.

@RoYouL
Copy link

RoYouL commented Apr 9, 2023

/usr/local/lib/node_modules/nrm/cli.js:9 const open = require('open'); ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/nrm/node_modules/open/index.js from /usr/local/lib/node_modules/nrm/cli.js not supported. Instead change the require of index.js in /usr/local/lib/node_modules/nrm/cli.js to a dynamic import() which is available in all CommonJS modules. at Object. (/usr/local/lib/node_modules/nrm/cli.js:9:14) { code: 'ERR_REQUIRE_ESM' }
Node.js v18.15.0 C02F63FKMD6R:1.js bytedance$

Just change const open = require('open'); to const open = import('open'); at /usr/local/lib/node_modules/nrm/cli.js line 9. It works for me.

That works, thx a lot

@maxiaoqu
Copy link

you can run bash as “npm install invm -g”,details view in: https://github.com/maxiaoqu/nrm

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

6 participants