在Ubuntu 14.04中安装最新的Node.js版本

问题描述:

这是我在ubuntu 14.04 LTS中安装 nodejs 的方式:

This is the way I installed nodejs in ubuntu 14.04 LTS:

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get install nodejs

当我用以下方法检查节点版本时:

When I checked the node version with this:

node -v

我明白了

v0.10.37

但是最新版本是4.2.6和5.5.0.如何获得最新或更新版本?

But the latest version is 4.2.6 and 5.5.0. How can I get the latest or update version?

sudo apt-get install curl

对于Node.js v4

For Node.js v4

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

对于Node.js v5:

For Node.js v5:

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v6:

Node.js v6:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v7:

Node.js v7:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js 8:

Node.js 8:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

https://nodejs.org/en/download/package-manager/