nrm 安装后报错 Error [ERR_REQUIRE_ESM]: require() of ES Module

简介: nrm 安装后报错 Error [ERR_REQUIRE_ESM]: require() of ES Module
  • 安装 nrm 后,进行使用时报错
$ npm i -g nrm
/Users/xxx/.nvm/versions/node/v16.20.0/lib/node_modules/nrm/cli.js:9  
const open = require('open');  
^  
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/xxx/.nvm/versions/node/v16.20.0/lib/node_modules/nrm/node_modules/open/index.js from /Users/lixiaoxia/.nvm/versions/node/v16.20.0/lib/node_modules/nrm/cli.js not supported.  
Instead change the require of index.js in /Users/xxx/.nvm/versions/node/v16.20.0/lib/node_modules/nrm/cli.js to a dynamic import() which is available in all CommonJS modules.  
at Object.<anonymous> (/Users/xxx/.nvm/versions/node/v16.20.0/lib/node_modules/nrm/cli.js:9:14) {  
code: 'ERR_REQUIRE_ESM'  
}
  • 原因:应该使用 openCommonJs 规范的包,现在 open v9.0.0ES Module 版本的包。
  • 解决方案:
$ npm i -g nrm open@8.4.2 --save
相关文章
|
7月前
报错/ ./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2)怎么解决?
报错/ ./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2)怎么解决?
|
应用服务中间件 网络安全 nginx
./configure: error: SSL modules require the OpenSSL library.
CentOS 6.5 下 安装 Tengine 执行配置命令./configure  时提示以下错误: ./configure: error: SSL modules require the OpenSSL library.
1989 0
|
7月前
vue2项目安装出现Syntax Error: Error: Cannot find module ‘less‘
vue2项目安装出现Syntax Error: Error: Cannot find module ‘less‘
122 0
|
7月前
Module build failed (from ./node_modules/eslint-loader/index.js)
Module build failed (from ./node_modules/eslint-loader/index.js)
205 0
Module build failed (from ./node_modules/eslint-loader/index.js)
|
机器学习/深度学习 缓存 JavaScript
vue报错-Error: Cannot find module 'fs/promises'
vue报错-Error: Cannot find module 'fs/promises'
192 1
|
JavaScript
vue 报错:Module not found:Error:Can't resolve 'vuex' in XXX
vue 报错:Module not found:Error:Can't resolve 'vuex' in XXX
225 1
node Express.js node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module ‘
node Express.js node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module ‘
1129 0
node Express.js node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module ‘
【Error】This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/@babel
【Error】This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/@babel
nrm 安装后报错 Error [ERR_REQUIRE_ESM]: require() of ES Module
nrm 安装后报错 Error [ERR_REQUIRE_ESM]: require() of ES Module
630 0
|
资源调度 JavaScript Windows
yarn create vite的时候,报错:SyntaxError: Unexpected token ‘.‘ at Loader.moduleStrategy (internal/modules/
yarn create vite的时候,报错:SyntaxError: Unexpected token ‘.‘ at Loader.moduleStrategy (internal/modules/
683 0

热门文章

最新文章