常用命令:
npm uninstall npm -g
删除冗余的文件:
# 这里是用来删除node创建的各种文件夹
sudo rm -rf /usr/local/lib/node
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm*
# 删除node命令
sudo rm /usr/local/bin/node
# 删除node的所有man手册
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/share/man/man1/npm-*
sudo rm /usr/local/share/man/man1/npm.1
sudo rm /usr/local/share/man/man1/npx.1
sudo rm /usr/local/share/man/man5/npm*
sudo rm /usr/local/share/man/man5/package.json.5
sudo rm /usr/local/share/man/man7/npm*
# 这个命令也是删除一个node文件,但不知道这文件有什么用
sudo rm /usr/local/lib/dtrace/node.d
删除后,建议reboot电脑。
检测命令:
npm -v
转载请注明:苏demo的别样人生 » mac下卸载清理nodejs