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

低版本和高版本都都报错 #159

Closed
ruanye opened this issue Jun 2, 2023 · 1 comment · Fixed by P2K0/nrm#1
Closed

低版本和高版本都都报错 #159

ruanye opened this issue Jun 2, 2023 · 1 comment · Fixed by P2K0/nrm#1

Comments

@ruanye
Copy link

ruanye commented Jun 2, 2023

18 error:
/Users/mac/.nvm/versions/node/v18.16.0/lib/node_modules/nrm/cli.js:9
const open = require('open');
^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/mac/.nvm/versions/node/v18.16.0/lib/node_modules/nrm/node_modules/open/index.js from /Users/mac/.nvm/versions/node/v18.16.0/lib/node_modules/nrm/cli.js not supported.
14: error
nternal/modules/cjs/loader.js:1131
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/mac/.nvm/versions/node/v14.21.3/lib/node_modules/nrm/node_modules/open/index.js
require() of ES modules is not supported.
require() of /Users/mac/.nvm/versions/node/v14.21.3/lib/node_modules/nrm/node_modules/open/index.js from /Users/mac/.nvm/versions/node/v14.21.3/lib/node_modules/nrm/cli.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/mac/.nvm/versions/node/v14.21.3/lib/node_modules/nrm/node_modules/open/package.json.

@ZhangChengLin
Copy link

18.16.0
also not working

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

Successfully merging a pull request may close this issue.

2 participants