node.js - 尝试安装 npm 包并收到 EN0ENT 错误

标签 node.js gruntjs npm

这是运行 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. 

最佳答案

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

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

然后重新运行 npm 安装,无需 sudo

关于node.js - 尝试安装 npm 包并收到 EN0ENT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21741932/

相关文章:

javascript - 使用 node-mysql 时出现 SQL 解析错误

java - 使用 Java 创建 Node.js 加密 key

javascript - 发送 html+css 作为响应的简单 node.js 服务器

jquery - SailsJS v0.10.0-rc7/grunt 以正确的顺序加载 js 资源

javascript - 使用 grunt-ssh 下载远程资源

javascript - NPM 不工作(找不到模块 'internal/fs' - nodejs)

node.js - 无法在 Heroku 中安装 Node

javascript - 让 Axios 在其请求中自动发送 cookie

javascript - 在文件之间添加断行 Grunt - concat

node.js - 使用范围导入本地 npm 包