node.jswindowsnpmnvmnvm-windows

Updating npm when using nvm-windows


I'm using nvm-windows version 1.1.7.

I just installed node 11.9.0.

nvm installs npm version 6.5.0 together with this node version. However, there's npm version 6.7.0 available already.

When I now do npm i -g npm I get:

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

I found no way to avoid this.


Solution

  • Several workarounds are available in this Issue on the nvm-windows github repo:

    https://github.com/coreybutler/nvm-windows/issues/300

    There are examples using DOS, PowerShell, bash, and batch scripts.