15

No matter what I do with npm, remove it, re-install it, re-hash, etc, i still get this error when I try to run anything related to npm:

prompt$  npm

------

npm ERR! EEXIST, mkdir '/usr/local/bin/npm'
File exists: /usr/local/bin/npm
Move it away, and try again. 

What is the problem and how do I fix it?

I've deleted:

/usr/local/bin/node
/usr/local/bin/npm
~/.npm

then reinstalled. still receiving the same error.

Kristian
  • 21,204
  • 19
  • 101
  • 176
  • What exactly are you trying to do when you get this? Can you go to a random directory and type 'npm install async' - just choosing async randomly as a very small npm module. – iandotkelly Apr 03 '14 at 00:31
  • You could try 'npm cache clean' ..... see whether you have some corrupted cache. – iandotkelly Apr 03 '14 at 00:33
  • npm itself fails when it is typed, so `npm cache clean` also fails in the same way – Kristian Apr 03 '14 at 00:34

1 Answers1

15

I can only suggest a complete wipe of node.js and npm and reinstall. Fortunately node and npm are fairly lightweight packages so this is not too onerous.

I know you said you have reinstalled, but I suggest you manually remove all the folders that it uses to store information, in case some corrupted file is being left that is causing this. A guide to all the folder npm uses is found here:

https://www.npmjs.org/doc/files/npm-folders.html

Some configuration files are also used:

https://www.npmjs.org/doc/files/npmrc.html

This document has the following configuration files that might be relevant to issues that affect all uses of npm:

  • per-user config file (~/.npmrc)
  • global config file (${HOME}/.npm-packages/npmrc)
  • npm builtin config file (/path/to/npm/npmrc)

Other people commenting on this post have found success removing the ~/.npmrc file

If you are running on an un*x like platform, like OSX or Linux which support bash - I would recommend node version manager. This allows you to run multiple versions of node and npm - and you can can remove and reinstall versions completely.

https://github.com/creationix/nvm

iandotkelly
  • 9,024
  • 8
  • 48
  • 67