echo prefix=~/.npm-packages >> ~/.npmrc
wget https://registry.npmjs.org/npm/-/npm-5.5.1.tgz
tar xf npm-5.5.1.tgz
cd package
./npm-cli.js install npm -g
brew uninstall --force node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local #may not work
brew link --overwrite node
sudo brew postinstall node #may not work
你可能会遇到sudo的问题,但是不用担心,它应该可以在没有sudo的情况下工作 :)