How to install the latest nodejs version in ubuntu

As of writing this article the latest node version was 4.2.4, you can install this one using the distribution from NodeSource repository:

sudo apt-get install curl
curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install nodejs

You can find all the sources here, https://github.com/nodesource/distributions/tree/master/deb

Then, you have the latest version of node.js installed.