Upgrading Node.js with NPM in 3 commands
1 minute read
##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:
npm cache clean -f
# cleans out your cachenpm install -g n
# installs the n packagen 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.