Why do I get old versions of nodejs and npm when installing with apt-get?

user1283776 picture user1283776 · Jan 4, 2016 · Viewed 8.4k times · Source

I have executed the following command in Ubuntu 14.04 64-bit.

sudo apt-get update
sudo apt-get install nodejs modejs-legacy npm

I have the versions

npm -v
1.3.10

nodejs -v
v0.10.25

These are older than the recommended versions for AngularJS 2.

Why does apt-get download old version? How do I update to newer versions?

Answer

michelem picture michelem · Jan 4, 2016

Debian/Ubuntu has old version in their package manager, you have to use custom PPA repository as stated here:

https://github.com/nodejs/node-v0.x-archive/wiki/Installing-Node.js-via-package-manager#setup-with-ubuntu

Setup it with:

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -

Then install with Ubuntu:

sudo apt-get install --yes nodejs