19

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
  • 959
  • 2
  • 13
  • 24
user1283776
  • 16,122
  • 38
  • 122
  • 229
  • 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

15

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наđошƒаӽ
  • 15,289
  • 12
  • 72
  • 86
michelem
  • 13,830
  • 5
  • 49
  • 64
2

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,598
  • 21
  • 42