11

解决NVM报错:“nvm is not compatible with the npm config “prefix” option…”

 3 years ago
source link: https://www.bugcatt.com/archives/2518
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

阿航

2020年8月15日

28

解决NVM报错:“nvm is not compatible with the npm config “prefix” option…”

今天在MacOS上尝试使用NVM切换node版本时出现了如下报错:

nvm is not compatible with the npm config "prefix" option:
    currently set to "/usr/local/Cellar/nvm/0.35.3/versions/node/v10.21.0"
Run `npm config delete prefix`
    or `nvm use --delete-prefix v10.21.0` to unset it.

本篇文章就来记录下解决方案。

若要顺利阅读本篇文章, 需要你具备如下条件:

  • 掌握终端命令行基本用法
  • 掌握node,npm基本概念

本篇文章的环境:

环境版本MacOSCatalina 10.15.5nvm0.35.3nodev14.6.0npm6.14.7

一定要注意环境的差异, 考虑不兼容的可能性; 并且具备以上条件. 否则阅读本篇博客可能会给你带来困扰.

解决方案非常简单。只需在终端中依次输入以下命令即可:

npm config delete prefix
npm config set prefix $NVM_DIR/versions/node/v6.11.1

Credit

nvm is not compatible with the npm config “prefix” option


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK