29

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?

Will Hardwick-Smith
  • 969
  • 3
  • 13
  • 24
user1283776
  • 19,640
  • 49
  • 136
  • 276
  • 3
    possible duplicate of [How can I update Node.js and NPM to the next versions?](http://stackoverflow.com/q/6237295/710446). It doesn't answer the "why?" question, but that answer to that is, "because old version are what's in Canonical's software repositories for your version of Ubuntu" – apsillers Jan 04 '16 at 15:26
  • Both Debian and RHEL distros have old versions of node and npm. Not sure why node isn't supporting their linux packages, but it sure makes running servers tricky. – ssube Jan 04 '16 at 15:39

2 Answers2

24

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

https://github.com/nodesource/distributions/blob/master/README.md#debinstall

Setup it with:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

Then install with Ubuntu:

sudo apt-get install --yes nodejs
Sнаđошƒаӽ
  • 16,753
  • 12
  • 73
  • 90
michelem
  • 14,430
  • 5
  • 50
  • 66
4

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
Clint
  • 2,696
  • 23
  • 42