Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! Refusing to delete / code EEXIST

Tags:

node.js

npm

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.

like image 567
Azoulay Jason Avatar asked Oct 11 '22 01:10

Azoulay Jason


2 Answers

Steps

  1. Delete the node_modules directory completely.
  2. Run npm install again.

This should help.

like image 196
antzshrek Avatar answered Oct 13 '22 15:10

antzshrek


This was how I solved mine after 'googling' around...

  • Navigate to the directory your node was installed in
  • rename your npm.cmd and npm files
  • Try run the installation again
  • If successful..delete the files you renamed earlier npm and npm.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

like image 42
yemiOdetola Avatar answered Oct 13 '22 14:10

yemiOdetola