參考:https://www.jianshu.com/p/829a08cb19d8node
採用方案一npm
cd /usr/local lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom | while read f; do sudo rm ${f}; done lsbom -f -l -s -pf /var/db/receipts/org.nodejs.npm.pkg.bom | while read f; do sudo rm ${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node\_modules /var/db/receipts/org.nodejs.\* cd /usr/local/lib sudo rm -rf node\*
sudo rm -rf /usr/local/share/man/man1/node.1 sudo rm -rf /usr/local/lib/dtrace/node.d sudo rm -rf ~/.npm
mac上能夠經過brew install npm
可是可能由於網速問題,沒用採起此方案。vim
3.爲全局數據包制定一個新的位置,並定義到環境變量中code
mkdir ~/.npm-global
npm config set prefix '~/.npm-global’ vim ~/.profile 添加: export PATH=~/.npm-global/bin:$PATH
source ~/.profile npm install -g jshint
/Users/neilliu/.npm-global/bin/jshint -> /Users/neilliu/.npm-global/lib/node\_modules/jshint/bin/jshint \+ jshint@2.11.0