Ubuntu – Unable to install latest NodeJS version on Ubuntu 14.04

14.04nodejssoftware installation

On my server I have 0.10.25 "I do not need Rea's version, that is "0.10.30" which is the LTS for nodejs, however developers asking to install 4th version, after digging a little bit, I have found that 0.12 it the same nodejs merged with some other packages.

There is no package source for 0.12, I have downloaded .tar.gz files form nodejs's website, unpacked, but it does not contain any installation script, moving files manually or creating links is not the way I wish to go, what can I do?

Update:

[web01]~> nodejs -v
v0.10.25
[web01]~> apt-get install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[web01]~> curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
[web01]~> apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[web01]~> uname -a
Linux web01.example.lab 3.19.0-28-generic #30~14.04.1-Ubuntu SMP Tue Sep 1 09:32:55 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[web01]~> 

Best Answer

The easiest way to install NodeJS is using the official PPA (which contain the latest version (8.X at the time of this edit).

Open a terminal (Ctrl+Alt+T) and run :

  1. Remove current NodeJS installation

    sudo apt-get purge nodejs*
    
  2. Install curl

    sudo apt-get install curl
    
  3. Install NodeJS:

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

If you absolutely need 0.12 and not 4.1.1 version, run :

  1. Install NodeJS:

    curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
    sudo apt-get install -y nodejs
    
Related Question