如何跟上最新版本的 Node.js 在 Ubuntu? PPA? 编译?

在哪里可以找到最新版本的 Node.js 的. deb 包?

如果没有,并且因为这是一个进展非常快的项目,那么跟上 Node.js 发布的最简单的方法是什么?

  • 添加一些 PPA 和它将更新时,有一个新的包?
  • ./configure & & make & & ln-s./node/usr/bin/node?
  • 你知道的其他方式,我无法想象,但希望你能分享?
41268 次浏览

Most up-to-date ppa for nodejs https://launchpad.net/~chris-lea/+archive/node.js/

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

NOTE: If your system does not have add-apt-repository, it can be installed like so:

sudo apt-get install python-software-properties

You could also use tools like for example nvm which can help you install node and even have multiple versions.

I'm the maintainer of the PPA listed above. I actually maintain three distinct Node PPAs:

https://launchpad.net/~chris-lea/+archive/node.js https://launchpad.net/~chris-lea/+archive/node.js-devel https://launchpad.net/~chris-lea/+archive/node.js-legacy

They contain the current release, the development release, and the "previous stable line" respectively. Here's some more info on using them:

https://chrislea.com/2013/03/15/upgrading-from-node-js-0-8-x-to-0-10-0-from-my-ppa/

I currently intend to keep maintaining these unless the Joyent folks start maintaining their own repositories. They have me on IM so I'm generally quite aware of when new releases are coming out, and I try to put up new builds within a day of the source code being available.

me again (the maintainer of the above referenced PPA on Launchpad).

In a going forward sense, I will be making packages under the banner of the NodeSource organization. Please see here:

https://nodesource.com/blog/chris-lea-joins-forces-with-nodesource

Same me doing the work, same functionality, just a better support system and more resources to make sure I'm doing things right. Enjoy.

For those who keep falling into this thread from search engines

Currently (Dec 2015) nodesource.com keeps up-to-date node repos for several distros. Installing up-to-date nodej js is as simple as pasting this snippet into console:

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

You'll find more info on installing node in different version or different distributions here: https://github.com/nodesource/distributions#installation-instructions

Chris Lea PPA stopped at 0.10 and Chris joined forces with nodesource :)

If it's the latest version of Node.js you wish to install, the easiest method is to use Node Version Manager (NVM). It's safer than upgrading the node packages in Ubuntu to unsupported versions from PPAs or 3rd party repos, which may cause conflicts or breakages in apt package management system. Compared to NVM, manual installations from tarballs are harder to maintain and upgrade. Follow these steps to install the latest node using NVM:

Step 1: Install NVM

Run this command in Terminal:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

Step 2: Install node

Once NVM installation is complete, close and reopen Terminal. Then run this command:

nvm install node

Step 3: Check node version

Run these commands:

node --version
npm --version

If everything went well, you'll see the latest node and npm versions as output. That's all, node is installed and ready to run! 😊

Keep up with the latest node

Even if you install the latest version of node, you may have to upgrade it a few weeks or months later due to the fast paced development of node. NVM makes it easier to upgrade, while at the same time enabling migration of previously installed global npm packages. Run this command to upgrade:

nvm install node --reinstall-packages-from=node