How to Upgrade node.js and NPM on Windows
NPM team have provided (made with ? for NPM) a windows upgrade tool to easily upgrade NPM. This is very tiny tool that intended to optimize the upgrade process with a simple command. If you’re not familiar with CLI download and install the latest .msi package from http://nodejs.org/download/.
Usage - NPM
First of all, navigate to Windows PowerShell / CMD to execute the command that can install the windows upgrade tool. To run Windows PowerShell, Click start button, on search for “Windows PowerShell” and then start with Run as Administrator option.
Paste the following command onto the shell, this is to ensure upgrade the PowerShell execution policy where by allowing the system to execute the script. Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force Now, to install windows upgrade tool on the system execute the following command.
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Once the installation have successfully completed, paste the following command.
If you want to manually specify the version use like the following
npm-windows-upgrade --npm-version 5.5.0
After execution it will list all available versions, use UP and DOWN arrows to pick your desired version and hit enter key to initiate installation process. npm version Use the above command to verify the version.
Usage – node.js
Upgrading node.js is pretty simple, execute the following command. Don’t forget to execute “cache clean” command, otherwise you will show the old version.
npm install –g node npm cache clean –f
To verify the version