Upgrading Node.js with NPM in 3 commands

The Better Way: NPM

When I've upgraded Node in the past, I've had to go to the nodejs.org site and pull a new image. This gets a little annoying after a couple times. There has to be a better way, right?

Turns out there is: via NPM.

NPM (Node Package Manager) is fantastic; it's a great way to manage, install, uninstall, and register packages.

To upgrade Node to a new version, you can use the n package. Here's the whole process in three commands:

  1. npm cache clean -f # cleans out your cache
  2. npm install -g n # installs the n package
  3. n stable # upgrades your version of node

Easy as that! No more images to grab or long installation processes to wait for. Now go back to hacking and have some fun.