日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

macOS 升級后 nvm 安裝的 node 和 npm 出錯

作者:rrdawlx 更新時間: 2022-01-13 編程語言

macOS 升級后,發現用 nvm 安裝的 node 和 npm 命令全都沒了,打開命令行工具的時候會有如下錯誤提示:

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'ansi-regex'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/rrdawlx/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/strip-ansi/index.js:2:17)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v10.10.0 --silent` to unset it.

解決方法是先刪除已安裝的 node 版本,比如nvm uninstall v10.10.0;然后重新安裝 node,比如nvm install node。

原文鏈接:https://blog.csdn.net/wlx1991/article/details/83990280

欄目分類
最近更新