-
安裝
nrm
后,進(jìn)行使用時(shí)報(bào)錯(cuò)$ 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' }
-
原因:應(yīng)該使用
open
的CommonJs
規(guī)范的包,現(xiàn)在open v9.0.0
是ES Module
版本的包。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-508965.html -
解決方案:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-508965.html
$ npm i -g nrm open@8.4.2 --save
到了這里,關(guān)于nrm 安裝后報(bào)錯(cuò) Error [ERR_REQUIRE_ESM]: require() of ES Module的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!