code: 'ERR_REQUIRE_ESM',open模块不支持esm

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版本

npm install -g nrm open@8.4.2 --save

code: 'ERR_REQUIRE_ESM',open模块不支持esm
https://blog.jishu6.com:18080//archives/code-err_require_esm-openmo-kuai-bu-zhi-chi-esm
作者
tab
发布于
2023年04月17日
许可协议