How to upgrade Node.js via NPM

There are many utilities which require the latest version of Node.js to run properly until you upgrade to latest version of node.js you will not be able to download those utilities. You can upgrade by downloading the latest image from the or you can follow a simple way to upgrade node.js via NPM to its latest version as shown below.

Upgrade Node.js via NPM on Linux/MAC

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

The value n represents as node helper and the command sudo n stable will upgrade the node to the latest stable version that has been released.

If you desire to install a specific version of node.js version then you can go ahead and type the below command.

sudo n 0.12.2

To check the Node.js version currently installed in you system use the below command

node -v

Upgrade Node.js via NPM on windows

Download the “Windows Installer (.msi)” from and follow the installation steps to install node.js. After complete the installation above, the NodeJS and NPM will be upgraded to the latest one automatically.

If you already have the node.js installed then go to node.js command prompt and type the below commands to upgrade to the latest version.

npm cache clean
npm update -g
Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like

npm in Node.js

Table of Contents Hide What is npm in Node.js?Installing Modules using npmGlobal vs Local Installation What is npm in Node.js? Node Package Manager (npm) as the name indicates it is…
View Post