linux更新nodejs
配置更新源
1
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
添加 nodejs 更新源
1
sudo curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
更新系统,并安装编译包
1
2sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y build-essential安装Node.js,同时会自动安装npm
1
$ sudo apt-get install -y nodejs
更新node/npm/npx
1
$ sudo npx dist-upgrade
如果发生错误
1
2sudo npm cache verify
sudo npm cache clean --force更换淘宝源码
1
2
3sudo npm --registry http://registry.npm.taobao.org/ i -g nrm
nrm use taobao
sudo npx dist-upgrade
This blog is under a CC BY-NC-SA 3.0 Unported License
本文链接:https://blog.suixin.kim/2018/03/20/linux-update-nodejs/