Can't update npm packages: ERR! code EEXIST

Try doing this below command after deleting the folder C:\Users\xxx\AppData\Roaming\npm, C:\Users\xxx\AppData\Roaming\npm-cache.

npm install -g npm@latest

To resolve this issue I took the following steps

Where [userName] is your Windows user name -- [nodeVer] is your current version of Node, or the one that is giving you issues using NVM

Delete these four files:

C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npm
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npm.cmd
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npx
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npx.cmd

Then in C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\node_modules\, rename the npm directory to npm_old

Open up your console of choice -- run as admin if necessary -- and navigate into the \npm_old\bin directory then install NPM at latest (or replace latest w/a version of your choosing) using the command below:

node npm-cli.js i -g npm@latest

Clean-up by deleting the npm_old directory from earlier. Now all should be good to go...I hope!

Tags:

Node.Js

Npm

Nvm