5ecured
5ecured

Reputation: 201

Is there really no straightforward way to update node and npm on windows?

Have spent far too long on this, about to give up.

I know you can go to the official website to update Node but I would like to be able to do it through the command line.

Anyway, when I do npm install npm@latest -g

I get

npm ERR! code EEXIST
npm ERR! path D:\nodejs\npm.cmd
npm ERR! Refusing to delete D:\nodejs\npm.cmd: is outside D:\nodejs\node_modules\npm and not a link
npm ERR! File exists: D:\nodejs\npm.cmd
npm ERR! Move it away, and try again.

I found another solution but did not work for me:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install --global --production npm-windows-upgrade
npm-windows-upgrade

This works up to this far, then it asks me for which version I want to install. I select it, then I get:

You wanted to install npm 6.14.5, but the installed version is 6.13.4.

A common reason is an attempted "npm install npm" or "npm upgrade npm". As of today, the only solution is to completely uninstall and then reinstall Node.js. For a small tutorial, please see https://github.com/felixrieseberg/npm-windows-upgrade#usage.

Please consider reporting your trouble to https://aka.ms/npm-issues.

I am almost dead. Any help appreciated!

Upvotes: 1

Views: 344

Answers (1)

Related Questions