
Upgrading Node.js to the latest stable version via NPM
The commands below can be used to update your local running version of Node.js to the latest stable version using NPM.
$ sudo npm cache clean -f
$ sudo npm install -g n
$ sudo n stable
Now run node -v
to verify that you have been upgraded to the latest stable version