以下解决方法只在mac上尝试过
如果在安装了node.js之后无法使用npm可以尝试以下的解决方法:
- 安装brew
xcode-select –install
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
- 重新安装node.js
brew update
brew uninstall node
brew install node
然后可以试试npm命令。