How to install node.js and npm on ubuntu 14.04

The top result for “how to install node on ubuntu 14.04” is currently this DigitalOcean article. Unfortunately, their first suggestion, installing via apt-get, will install an old version of node and a very old version of npm that cannot properly update itself (because of path differences). Their second suggestion is much better. Simply:

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

This is all you need to do. npm is bundled with node.js and will be installed automatically if you install this way. If you want to make sure you’ve got the very most recent release of npm, you can do:

sudo npm install npm -g

This step is optional. At the moment Chris Lea’s PPA will give you npm 1.4.9, which is recent enough to have no showstopper problems (the version that comes with apt, 1.3.10, is not terrible but has some known bugs).

P.S. I have blogged previously about the best way to install npm on other platforms, which is similarly simple.

An astonishing experimental therapy; the virus, rendered harmless to its host, used tumor cells to reproduce the way it always does: by reproducing itself inside of them and forcing them to explode and die. By giving her a massive dose of the vaccine, the viruses attacked all the tumor cells at once, eliminating the cancer.