0. ubuntu安装node\npm
- 从 NodeSource 中安装 Node.js 和 npm
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install nodejs
1. node切换版本
sudo npm install n -g
# 安装稳定版
sudo n stable
# 安装最新版
sudo n latest
# 版本降级/升级
sudo n rm 版本号
2. npm update
2.1. 更新到最新版本
npm install -g npm
2.2. 更新到指定版本
npm -g install npm@6.8.0
2.3. 清理 npm 缓存数据
npm cache clean --force