Install Node.js (and NPM)

> sudo apt-get update

If at this point you might get an error like

W: There is no public key available for the following key IDs:
XXXXXXXXXXXXXXXXXXXXXXX

We do not install “debian-keyring”, which is big and 99% of the time unnecessary:

> sudo apt-get install debian-archive-keyring
> sudo apt-key update

The above will work, or not, depending on whether or not the key 'XXXXXXXXXXXXXXX' is present in the packages they indicate.

If you need a specific key, you have to get it, and know on which server to find it, it's in a key server (very probably any key server will do):

> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXXXXXXXXX

We'll need curl first:

> sudo apt-get install curl

Then, to install Node.js (LTS is v4 at the time of this writing)

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

That's it !

You should now have node.js, as well as npm, installed on your system:

> node -v
v4.8.3

> npm -v
2.15.11