Installing Up-To-Date Node.js on Linux

I’m running a recent version of XUbuntu, and have installed Node.js via the package manager. But, the version in the Ubuntu repos is horribly out of date:

$ nodejs -v
v0.10.25

As of today, the LTS version is 4.4.0. It’s pretty easy to install from the source. But, there’s a better way. The Node.js project maintains a set of repos for most Linux distros, which includes excellent installation instructions. In my case, it was incredibly simple:

$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
[sudo] password for kenneth: 

## Installing the NodeSource Node.js 4.x LTS Argon repo...

...

## Adding the NodeSource signing key to your keyring...

## Creating apt sources list file for the NodeSource Node.js 4.x LTS Argon repo...

...

## Running `apt-get update` for you...

Then, I installed the shiny new Node.js using Aptitude – because Aptitude is the bomb:

$ sudo aptitude install nodejs
The following NEW packages will be installed:
rlwrap{a} 
The following packages will be upgraded:
nodejs{b} 
1 packages upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 8,781 kB of archives. After unpacking 38.6 MB will be used.
The following packages have unmet dependencies:
nodejs : Conflicts: nodejs-dev but 0.10.25~dfsg2-2ubuntu1 is installed.
      Conflicts: npm but 1.4.21+ds-2 is installed.
nodejs-dev : Depends: nodejs (= 0.10.25~dfsg2-2ubuntu1) but 4.4.0-1nodesource1~wily1 is to be installed.
The following actions will resolve these dependencies:

 Remove the following packages:
1)     nodejs-dev
2)     npm

No problem, Ghost Rider, just accept the solution to remove the original packages and roll on:

Accept this solution? [Y/n/q/?] y
The following NEW packages will be installed:
rlwrap{a} 
The following packages will be REMOVED:
...
The following packages will be upgraded:
  nodejs 
1 packages upgraded, 1 newly installed, 60 to remove and 1 not upgraded.
Setting up nodejs (4.4.0-1nodesource1~wily1) ...

All done!

nodejs -v
v4.4.0

Get your up-to-date Node.js on!

share this:Email this to someoneTweet about this on TwitterShare on LinkedInShare on Facebook

Published by

Kenneth

Software developer. Problem solver.