THIS POST IS OUTDATED. Look at Install NodeJS and NPM on Ubuntu 16.04 instead.
You've probably used
apt-get to install NodeJS (if not, just run
apt-get install nodejs-legacy) on your computer (mind the binary problems) so chances are that, when you actually get down to doing some work, you've fallen behind and need to update.
Weird as it sounds (think of it like using using
gemto install a new
rubyversion), the best way to install and upgrade nodejs on Ubuntu is using npm. So here's what you need to do:
HEADS-UP sometimes you need to close your current terminal window and open a new one for changes to take effect
$ sudo npm cache clean -f $ sudo npm install -g npm
View current npm version
$ npm -v 3.8.5
$ sudo npm install -g n $ sudo n stable
View current nodejs version
$ node -v v5.10.1