【发布时间】:2013-01-19 16:33:37
【问题描述】:
我在运行 npm run-script grunt 后遇到一个奇怪的错误,它告诉我 node_modules/.bin/grunt 失败。
我正在学习一个教程,因为我对 Backbone (http://dailyjs.com/2012/11/29/backbone-tutorial-1/) 很陌生,
这是我的package.json 文件。
{
"name": "btask"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"requirejs": "latest"
, "connect": "2.7.0"
}
, "devDependencies": {
"mocha": "latest"
, "chai": "latest"
, "grunt": "latest"
, "grunt-exec": "latest"
}
, "scripts": {
"grunt": "node_modules/.bin/grunt"
}
}
这是错误的完整记录。
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/Users/Keva161/.nvm/v0.8.18/bin/npm',
1 verbose cli 'run-script',
1 verbose cli 'grunt' ]
2 info using npm@1.2.4
3 info using node@v0.8.18
4 verbose read json /Users/Keva161/Documents/Web Dev/Webapps/Node/btask/package.json
5 verbose run-script [ 'pregrunt', 'grunt', 'postgrunt' ]
6 info pregrunt btask@0.0.1
7 info grunt btask@0.0.1
8 verbose unsafe-perm in lifecycle true
9 silly exec sh "-c" "node_modules/.bin/grunt"
10 silly sh,-c,node_modules/.bin/grunt,/Users/Keva161/Documents/Web Dev/Webapps/Node/btask spawning
11 info btask@0.0.1 Failed to exec grunt script
12 error btask@0.0.1 grunt: `node_modules/.bin/grunt`
12 error `sh "-c" "node_modules/.bin/grunt"` failed with 2
13 error Failed at the btask@0.0.1 grunt script.
13 error This is most likely a problem with the btask package,
13 error not with npm itself.
13 error Tell the author that this fails on your system:
13 error node_modules/.bin/grunt
13 error You can get their info via:
13 error npm owner ls btask
13 error There is likely additional logging output above.
14 error System Darwin 12.2.1
15 error command "node" "/Users/Keva161/.nvm/v0.8.18/bin/npm" "run-script" "grunt"
16 error cwd /Users/Keva161/Documents/Web Dev/Webapps/Node/btask
17 error node -v v0.8.18
18 error npm -v 1.2.4
19 error code ELIFECYCLE
20 verbose exit [ 1, true ]
【问题讨论】:
-
您在 Windows 上吗?我在使用该配置的 Windows 上运行 grunt 时遇到问题...
-
osx 上没有即时消息:/ 我也尝试全局安装 grunt,但同样的错误
-
我不认为这是你的情况,但我不得不将 package.json 的“脚本”部分更改为在 Windows 上工作:
"grunt": "node_modules\\.bin\\grunt"
标签: node.js backbone.js gruntjs