由于 EEXIST 错误,NPM 无法运行 [英] NPM wont run due to EEXIST error
问题描述
无论我用 npm
做什么,删除它,重新安装它,重新散列等等,当我尝试运行与 npm<相关的任何东西时,我仍然会收到这个错误/代码>:
prompt$ npm------npm 错误!EEXIST, mkdir '/usr/local/bin/npm'文件存在:/usr/local/bin/npm把它移开,然后再试一次.
问题是什么,我该如何解决?
我已删除:
/usr/local/bin/node/usr/local/bin/npm~/.npm
然后重新安装.仍然收到同样的错误.
我只能建议完全擦除 node.js 和 npm 并重新安装.幸运的是,node 和 npm 是相当轻量级的包,所以这并不太繁重.
我知道你说你已经重新安装,但我建议你手动删除它用来存储信息的所有文件夹,以防留下一些损坏的文件导致这种情况.npm 使用的所有文件夹的指南可以在这里找到:
https://www.npmjs.org/doc/files/npm-folders.html一个>
也用到了一些配置文件:
https://www.npmjs.org/doc/files/npmrc.html>
本文档包含以下可能与影响 npm 所有使用的问题相关的配置文件:
- 每个用户的配置文件 (~/.npmrc)
- 全局配置文件 (${HOME}/.npm-packages/npmrc)
- npm 内置配置文件 (/path/to/npm/npmrc)
评论这篇文章的其他人发现删除 ~/.npmrc 文件成功
如果您在类似 un*x 的平台上运行,例如支持 bash 的 OSX 或 Linux - 我会推荐节点版本管理器.这允许您运行多个版本的 node 和 npm - 您可以完全删除和重新安装版本.
https://github.com/creationix/nvm
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.
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
这篇关于由于 EEXIST 错误,NPM 无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!