1. 安装完nrm运行命令报错
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\用户名\AppData\Roaming\npm\node_modules\nrm\node_modules\open\index.js from C:\Users\用户名\AppData\Roaming\npm\node_modules\nrm\cli.js not supported.
Instead change the require of index.js in C:\Users\用户名\AppData\Roaming\npm\node_modules\nrm\cli.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\用户名\AppData\Roaming\npm\node_modules\nrm\cli.js:9:14) {
code: 'ERR_REQUIRE_ESM'
}
以上的报错是通过:npm install nrm -g 命令运行完成出现的
2. 解决方法
运行如下命令
npm install -g nrm open@8.4.2 --save
3. 测试
C:\Users\用户名>nrm ls
npm ---------- https://registry.npmjs.org/
yarn --------- https://registry.yarnpkg.com/
tencent ------ https://mirrors.cloud.tencent.com/npm/
cnpm --------- https://r.cnpmjs.org/
taobao ------- https://registry.npmmirror.com/
npmMirror ---- https://skimdb.npmjs.com/registry/