Installing Up-To-Date Node.js on Linux
by kenneth |
posted in
dev |
18 March 2016
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:
As of today, the LTS version is 16.11.5. 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:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
$ curl -sL https://deb.nodesource.com/setup_6.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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
$ 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:
1
2
3
4
5
6
7
8
9
|
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!
Get your up-to-date Node.js on!