node version v16.18.0 ERROR: ERR_REQUIRE_ESM
BigHugeC4 opened this issue · comments
const open = require('open');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\npm\node_modules\nrm\node_modules\open\index.js from D:\npm\node_modules\nrm\cli.js not supported.
Instead change the require of index.js in D:\npm\node_modules\nrm\cli.js to a dynamic import() which is available in all CommonJS modules.
at Object. (D:\npm\node_modules\nrm\cli.js:9:14) {
code: 'ERR_REQUIRE_ESM'
}
"open" use version 8.4.2 is fine
遇到了同样的问题 插眼
遇到了同样的问题 插眼
package | version |
---|---|
node | 14.19.3 |
npm | 6.14.17 |
window | 10 |
从本地
npm i nrm -g
2023-03-21 9:23 分最新版本
下载的版本是 1.2.5
依赖的 open包 是
nrm 下的 node_modules 里面下载的是 open的最新版本
应该使用 open 的 CommonJs规范的包
现在 open: :9.0.0 是 ES Module 版本的
目前只能降级 nrm 为
这在 open 的github 上也是看到了 更新日志 https://github.com/sindresorhus/open/releases
try to use this command to lock the version of open pacakge at 8.4.2
npm install -g nrm open@8.4.2 --save
got the same error message
just install it from GitHub directly
npm i -g github:Pana/nrm
try to use this command to lock the version of open pacakge at 8.4.2
npm install -g nrm open@8.4.2 --save
解决问题了,感谢!
just install it from GitHub directly
npm i -g github:Pana/nrm
Installing from github does not seem to be a good solution to network congestion, and there may be download failures
try to use this command to lock the version of open pacakge at 8.4.2
npm install -g nrm open@8.4.2 --save
这不是nrm包的内部依赖吗,为何要单独全局安装,似乎不是很好的解决方案
像我们在 jekenis 自动发布, 以前只要 全局安装 npm - nrm -g 即可; 现在多了一个前置包 open, 对 运维也是一个负担
毕竟真的有运维搞不懂 node 和前端这个庞大的生态
插眼
same error