Simply follow the instructions given here:
Example install:
sudo apt-get install python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs
It installs current stable Node on the current stable Ubuntu. Quantal
(12.10) users may need to install the software-properties-common
package for theadd-apt-repository
command to work:sudo apt-get install software-properties-common
As of Node.js v0.10.0, the nodejs package from Chris Lea’s repo
includes both npm and nodejs-dev.
Don’t give sudo apt-get install nodejs npm
. Just sudo apt-get install nodejs
.