[NodeJS] upgrade NodeJS with npm

Normally, it is a little boring to generate versions. Today I want to install sails.js, when I do “sudo npm -g install sails”, it displays several WARN in red, don’t be afraid, there are some command to upgrade your node with npm to the last version or the version that you want.

sudo npm cache clean -f   # Clear your npm cache
sudo npm install -g n     # Install "n" which is node binary module
sudo n stable

you could specify a desired version:

sudo n 0.8.21