Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM wont run due to EEXIST error

Tags:

node.js

npm

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.

like image 500
Kristian Avatar asked Apr 03 '14 00:04

Kristian


People also ask

Why is my npm not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.

Why is npm start giving error?

The Missing script: "start" error occurs for multiple reasons: Missing a start script in the scripts section of your package. json file. Opening your IDE or shell in a directory that doesn't contain your package.


1 Answers

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

like image 63
iandotkelly Avatar answered Oct 02 '22 21:10

iandotkelly