nvm is not compatible with the npm config prefix option:

If NVM installs node under max, the solution to report the following error

nvm is not compatible with the npm config "prefix" option:
currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

Solution: if the node is managed by NVM installed through brew, then

In ~ /. Bashrc, ~ /. Bash_ Profile, ~ /. Profile, or ~ /. Zshrc file, add the following command:

export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
export NVM_DIR="$HOME/.nvm"
source $(brew --prefix nvm)/nvm.sh

If the node managed by NVM is installed directly instead of through brew, then

In ~ /. Bashrc, ~ /. Bash_ Profile, ~ /. Profile, or ~ /. Zshrc file, add the following command:

export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
export NVM_DIR="$HOME/.nvm"
source ~/.nvm/nvm.sh

Similar Posts: