【问题标题】:Trying to install npm packages and getting EN0ENT errors for everything尝试安装 npm 包并为所有内容获取 EN0ENT 错误
【发布时间】:2014-03-11 14:31:01
【问题描述】:

这是运行 npm install grunt-cli 的示例输出

注意到 node_modules 路径的重复了吗?这是环境路径问题吗?当我在 OSX 上对另一个用户尝试相同的命令时,它可以正常工作。

运行最新的 OSX 10.9.1

npm http 304 https://registry.npmjs.org/weak
npm http 304 https://registry.npmjs.org/bunker
npm http 304 https://registry.npmjs.org/argparse
npm http 200 https://registry.npmjs.org/mocha/-/mocha-0.3.3.tgz
npm http 200 https://registry.npmjs.org/should/-/should-0.3.2.tgz
npm http GET https://registry.npmjs.org/tiny-lr/0.0.4
npm http GET https://registry.npmjs.org/cli/0.4.3
npm http GET https://registry.npmjs.org/jasmine-node
npm ERR! Error: ENOENT, lstat '/Users/shanejordan/Documents/Projects/KiddoMath/code/node_modules/grunt-cli/node_modules/resolve/node_modules/tap/node_modules/difflet/node_modules/traverse/index.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-cli"
npm ERR! cwd /Users/shanejordan/Documents/Projects/KiddoMath/code
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /Users/shanejordan/Documents/Projects/KiddoMath/code/node_modules/grunt-cli/node_modules/resolve/node_modules/tap/node_modules/difflet/node_modules/traverse/index.js

更新: 我运行 npm cache clean 并收到了

npm ERR! Error: EACCES, unlink '/Users/shanejordan/.npm/_git-remotes/git-github-com-jkroso-forEach-f0435201/bra‌​nches' That must be my room problem. 

【问题讨论】:

  • 虽然我不知道你的问题的具体原因,但是重复的node_modules是由于依赖,依赖的依赖等等。
  • 明白了。也许那时不是这样。我不明白为什么 ENOENT 一直在发生。看起来它开始工作了,然后它将像这样运行 5 分钟......看起来它抓住了对 npm 的每个依赖项,以及这些类型的错误。无论我尝试安装什么软件包
  • 您是否尝试过查看引发ENOENT 错误的路径?
  • npm 安装在哪个用户下?也许 node/npm setup 已经为安装它的人设置了 env,而不是为所有用户设置?
  • 我只有一个用户。我创建了另一个只是为了测试它是否与我的特定用户环境有关。好像是这样。我之前确实用 sudo 安装了一些 npm 包,后来我知道这是不行的。

标签: node.js gruntjs npm


【解决方案1】:

我过去遇到过这个问题,对我来说有效的解决方案是运行

npm cache clean

然后再次尝试重新运行 npm install 命令。

更新:

如果失败了

npm ERR! Error: EACCES, unlink ...

那么这意味着 npm 进程doesn't have access to remove that directory。您是否使用sudo 运行任何npm 安装命令?如果是这样,它可能值得运行

sudo npm cache clean

然后在没有sudo 的情况下重新运行 npm 安装

【讨论】:

  • 我运行了 npm cache clean 并收到了 npm ERR!错误:EACCES,取消链接 '/Users/shanejordan/.npm/_git-remotes/git-github-com-jkroso-forEach-f0435201/branches' 这一定是我的房间问题。
  • 我已经尝试清除缓存,但仍然无法正常工作,它会抛出错误“'%E2%80%93g' is not in the npm registry. npm ERR! 404 You should bug the作者发布它”
  • 这是对我有用的解决方案。 FWIW,我在不使用 sudo 的情况下安装生成器时遇到了一些严重问题,并且发现使用 sudo 安装它们会导致其他问题。我卸载了 npm,然后使用 nvm(节点版本管理器 - 不错的工具)重新安装了它,这几乎可以确保您永远不必再次使用 sudo(以及许多其他不错的功能)。我确实必须使用 sudo 进行 npm 缓存清理,但之后一切都按预期工作。
猜你喜欢
  • 1970-01-01
  • 2020-04-21
  • 2016-11-23
  • 1970-01-01
  • 2011-12-04
  • 2020-12-04
  • 2017-10-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多