Install the latest Node.js on Ubuntu 14.04

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 4.x on older distros.

Node.js v6.x:

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

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_6.x | bash -
apt-get install -y nodejs

Node.js v5.x:

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

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_5.x | bash -
apt-get install -y nodejs

Node.js v4.x:

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

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs

For installations on other platforms, you can refer to: https://github.com/nodesource/distributions#debinstall



转载请注明出处:Install the latest Node.js on Ubuntu 14.04
原文地址:https://www.xiaotanzhu.com/linux/2016-08-05-install-nodejs-on-ubuntu.html