npm ERR! Refusing to delete / code EEXIST
I'm just running a simple npm install
and i get this error.
npm ERR! path /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/@angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which
npm ERR! code EEXIST
npm ERR! Refusing to delete /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/@angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which: is outside /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/@angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/which and not a link
npm ERR! File exists: /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/@angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which
npm ERR! Move it away, and try again
This is the first time I get this error and I don't know what to do.
Steps
- Delete the
node_modules
directory completely. - Run
npm install
again.
This should help.
This was how I solved mine after 'googling' around...
- Navigate to the directory your node was installed in
- rename your
npm.cmd
andnpm
files - Try run the installation again
- If successful..delete the files you renamed earlier
npm
andnpm.cmd
- if not, :( :(
The cli commands here...in case you don't want to be renaming and stuffs
cd %ProgramFiles%\nodejs
ren npm.cmd npm2.cmd
ren npm npm2
npm2 install npm@latest -g
del npm2
del npm2.cmd
Rolf-schmidiger
Try running npm update -g npm
then run npm i
again.
If that doesn't work maybe npm cache clean
helps.
If that doesn't work either you should consider removing the node_modules
folder in your application and running npm i
again.
If you still have no luck, I suggest removing the package-lock.json
and the node_modules
folder before running npm i
.
I got this problem on Linux (npm is the current latest 5.6.0), because I created a tgz archive, and I needed to --dereference some symlinks (see man tar
) when creating a tgz archive (which was them copied to VM for testing). This way a lot of symlinks in node_modules/.bin
also became regular files.
npm says in the error message, .e.g.
npm ERR! Refusing to delete /path/to/node_modules/.bin/jest: is outside /path/to/node_modules/jest and not a link
For windows users (specific to windows 10) this must solve the problem.
Goto this folder:
C:\Users\[UserName]\AppData\Roaming\
delete or rename the npm
and npm-cache
folders.
This has fixed my problem in Windows.