这是运行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
UPDADE: 我跑 npm cache clean 并收到了
npm ERR! Error: EACCES, unlink '/Users/shanejordan/.npm/_git-remotes/git-github-com-jkroso-forEach-f0435201/branches' That must be my room problem.
答案 0 :(得分:3)
我过去曾经遇到过这个问题,对我来说,解决方案就是运行
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