mac node 卸载
如果是通过source
或者binaries
方式安装 Nodejs
, 需要手动删除 Node executables
和其他resources
, 另外就是使用 Homebrew
的方法 、nvm
方法 。
1. 手动方法:
需要按如下步骤卸载node + npm
:
- 从
/usr/local/lib
目录下删除全部node
和node_modules
- 之后,从
/usr/local/include
目录删除全部node
和node_modules
- 从
/usr/local/bin
目录删除node
,node-debug
和node-gyp
- 从
home
路径删除.npmrc
,.npm
,.node-gyp
,.node_repl_history
- 从
/usr/local/share/man/man1
路径删除node*
,npm*
- 从
/opt/local/bin
,opt/local/include
,/usr/local/share/doc
路径删除node
- 从
opt/local/lib
删除node_modules
- 从
/usr/local/share/systemtap/tapset
路径删除node.stp
sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.d
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
2. Homebrew 和 nvm 方法 :
如果是通过$ brew install node
方式在 Mac 上安装Nodejs
, 可通过如下方式:
#unintall
brew uninstall node;
brew cleanup;
rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d;
rm -rf ~/.npm;
#install
brew install node;
which node
export NODE_PATH='/usr/local/lib/node_modules'
reference :
[1] How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
标签:node,npm,lib,mac,usr,bin,homebrew,local From: https://www.cnblogs.com/zhuoss/p/17830457.html