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).

Via: Seldo's Tumblr