在 Ubuntu 上卸载 Node.JS 的方法: 使用命令 sudo apt-get 可以卸载 Ubuntu 上的 Node.JS, 然后手动删除 NPM 相关的目录即可.
在 Ubuntu 上卸载 Node.JS 的详细方法如下:
- #apt-get 卸载
- sudo apt-get remove --purge NPM
- sudo apt-get remove --purge Node.JS
- sudo apt-get remove --purge Node.JS-legacy
- sudo apt-get autoremove
- # 手动删除 NPM 相关目录
- rm -r /usr/local/bin/NPM
- rm -r /usr/local/lib/node-moudels
- find / -name NPM
- rm -r /tmp/NPM*
扩展:
Ubuntu 安装 Node.JS
1.1, 执行检查可更新的软件:
sudo apt-get update
1.2, 先用普通的 apt 工具安装低版本的 node, 然后再升级最新.
- sudo apt-get install Node.JS
- sudo apt install Node.JS-legacy
- sudo apt install NPM
1.3, 更换淘宝的镜像, 这个是必须的, 用过的 node 的人都知道.
sudo NPM config set registry https://registry.npm.taobao.org
1.4, 安装更新版本的工具 N, 执行:
sudo NPM install n -g
1.5, 更新新 node 版本, 执行:
sudo n stable
来源: http://www.css88.com/qa/node-js/10791.html