參考:https://github.com/felixrieseberg/npm-windows-upgradegit
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
.github
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Then, to install and use this upgrader tool, run (also from an elevated PowerShell or cmd.exe):npm
npm install --global --production npm-windows-upgrade npm-windows-upgrade
Want to just install the latest version? Sure:windows
npm-windows-upgrade --npm-version latest
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!this