A way to manage nodejs and npm on windows
For the ones starting with NodeJS and NPM on windows, you probably are asking yourself how to update those when a security flaw is found or when a new version comes out.
There is a way.
Updating NPM
You can update NPM by using npm-windows-upgrade
If you want to skip all the reading of their page, here’s the parts that you need to know (excerpt from the page):
First, ensure that you can execute scripts on your system by running the following command from an elevated PowerShell. To run PowerShell as Administrator, click Start, search for PowerShell, right-click PowerShell and select Run as Administrator
.
1 |
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force |
Then, to install and use this upgrader tool, run (also from an elevated PowerShell or cmd.exe):
1 2 |
npm install --global --production npm-windows-upgrade npm-windows-upgrade |
The tool will show you a list of all the published and available versions of npm (including pre-release and beta versions). Choose the one you want to install and let it do its thing!
Updating NodeJS
You can update NodeJS by using corey’s butler nvm-windows
You can download the latest version with the setup and then use the command line or PowerShell as Administrator and run nvm