I tried this:
sudo npm cache clean -f sudo npm install -g n sudo n stable
...but it didn't work.
How do I do this on Windows?
Go into %ProgramFiles%\nodejs\node_modules\npm and copy the file named npmrc in the new npm folder, which should be %appdata%\npm\node_modules\npm . This will tell the new npm where the global installed packages are.
You can downgrade the npm version by specifying a version in the related commands. If you want to downgrade npm to a specific version, you can use the following command: npm install -g npm@[version. number] where the number can be like 4.9. 1 or 8 or v6.
This is the new best way to upgrade npm on Windows.
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force npm install -g npm-windows-upgrade npm-windows-upgrade
Note: Do not run npm i -g npm
. Instead use npm-windows-upgrade
to update npm going forward. Also if you run the Node.js installer, it will replace the Node.js version.
npm-windows-upgrade -p -v latest
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With