如何在Ubuntu上更新Node.js

自己系统上一直用的1.0版本的,ES6都用不了,想要更新直接apt又不行。

有n包的话可以用sudo n stable

  如果想安装最新的 6.x 版本 只需要

1 #Using Ubuntu
2 curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
3 sudo apt-get install -y nodejs
4 
5 node -v

  如果要安装目前最稳定的4.x版本,改下curl的地址即可

1 # Using Ubuntu
2 curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
3 sudo apt-get install -y nodejs
原文地址:https://www.cnblogs.com/ziqian9206/p/7169379.html