The simple way to Install NodeJS on Ubuntu

Here is how I prefer to install nodejs without any struggle nor remote execution of scripts I don't trust using curl ! (Considering you already have an old version of nodejs installed, if not do : sudo apt-get install nodejs)

First, install "n" with :

sudo npm install -g n

n is a tool that let you easily manage and install nodejs versions from the command line. Its like nvm, but much easier !

Then install nodeJS like this :

sudo n lts

It will install the most recent long term release, and voilĂ  ! Its done. You could also install any other versions using n latest, n stable, or n 0.8.14. Just check the project's readme for more commands.

NOTE : NPM will probably stay stuck to an old version so you may also want to update it via :

sudo npm update -g npm