- 先安装n
curl -L https://git.io/n-install | bash
#centos
source ~/.bash_profile
#ubuntu
source ~/.bashrc
#一般安装完n后会默认安装last版本
- 使用n安装nodejs
#安装最新lts版
n lts
- 添加淘宝的的npm代理
npm config set registry https://registry.npm.taobao.org
curl -L https://git.io/n-install | bash
#centos
source ~/.bash_profile
#ubuntu
source ~/.bashrc
#一般安装完n后会默认安装last版本
#安装最新lts版
n lts
npm config set registry https://registry.npm.taobao.org
转载于:https://my.oschina.net/admq/blog/789020