Upgrading Node.js using npm

The Node.js ecosystem provides a tool to update Node from within npm called, simply, “n”.

Install n thus:

[bash]
sudo npm cache clean -f
sudo npm install -g n
[/bash]

I don’t know that clearing the cache is actually necessary, but a number of people have recommended doing so.

Update to the latest version of node using:

[bash]
sudo n stable
[/bash]

n allows node versions to be changed easily. The n package listing has details.

This entry was posted in Programming and tagged , , , . Bookmark the permalink.

Leave a Reply