Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 809
user1283776 Avatar asked Jan 04 '16 15:01

user1283776


People also ask

Why is Ubuntu nodejs so old?

The reason WHY the package manager has old versions of the binaries is due to the fact it takes time for the maintainers of the provided packages to properly build and test new ones with updated versions. The good thing is that you can consume and install packages from other repositories (ppa).

Is npm version tied to node version?

Node. js and NPM versions aren't directly connected, otherwise they would have matching versions.


2 Answers

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
like image 191
michelem Avatar answered Oct 04 '22 17:10

michelem


To get the latest version the easiest thing to do is install nvm. nvm install instructions

  1. install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
  2. nvm install v10.15.3
  3. (optional) set default nvm alias default v10.15.3
like image 20
Clint Avatar answered Oct 04 '22 17:10

Clint