Updating node.js using npm

Node.js is a rapidly developing open-source cross-platform runtime environment. Because it’s actively developed there are often updates to the current version. Because of this lots of packages end up using versions of node.js that are newer than the one on your machine, and that can mean that the the latest plugins and utils will end up breaking.

To update node.js you can either download the installer from the node.js website or you can type a few lines of code and away you go!

Check the current version:

node -v 
—> v0.10.0

Update npm and install the latest node.js version. You can also specify a particular version of node by replacing 'stable' with a specific version number such as '0.11.00'.

sudo npm cache clean -f  
sudo npm install -g n  
sudo n stable  

Check the latest version just to make sure it’s worked:

node -v
—> v0.12.2
Published on

Filled under


comments powered by Disqus