node-7.2.1 already installed, it's just not linked

时间:2022-06-21 12:44:08
直接在terminal下运行以卸载node和nvm:
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}

在安装node时提示:node-7.2.1 already installed, it's just not linked 导致无法运行node命令 

sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local
brew link --overwrite node
brew postinstall node

然后运行 node -v可以看到安装的node版本了