Ubuntu 18.04 安装nodejs、nmp

1.安装 nodejs

sudo apt-get install nodejs

2.安装nmp

sudo apt-get install npm

3.更换nmp源

sudo npm config set registry https://registry.npm.taobao.org
sudo npm config list

4.全局安装n管理器(用于管理nodejs版本)

sudo npm install n -g

5.更新npm版本

npm install -g npm

更新完之后需要重新登陆系统才能看到更新后的版本

6.更新nodejs版本

(1)清除npm缓存

npm cache clean -f

(2)升级node.js到最新稳定版

n stable

安装cnpm

国内更适合使用 cnpm ,在执行命令时只需将 npm 换成 cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

你可能感兴趣的:(Linux)