Grunt突然停止工作

试着在我的项目上运行Grunt build和Grunt watch,我遇到了以下错误:

Fatal Error: Unable to find local grunt. 

我确保文件没有被删除。 我试着重新安装Node和Grunt。 文件在那里,重新安装不起作用。 我已经包含了debugging文件以供参考。 有谁知道这个问题可能是什么?

 0 info it worked if it ends with ok 1 verbose cli [ 'E:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install' ] 2 info using npm@1.3.24 3 info using node@v0.10.25 4 verbose node symlink E:\Program Files\nodejs\\node.exe 5 error install Couldn't read dependencies 6 error package.json ENOENT, open 'D:\sites\alleywire\package.json' 6 error package.json This is most likely not a problem with npm itself. 6 error package.json npm can't find a package.json file in your current directory. 7 error System Windows_NT 6.1.7601 8 error command "E:\\Program Files\\nodejs\\\\node.exe" "E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 9 error cwd D:\sites\alleywire 10 error node -v v0.10.25 11 error npm -v 1.3.24 12 error path D:\sites\alleywire\package.json 13 error code ENOPACKAGEJSON 14 error errno 34 15 verbose exit [ 34, true ] 

您需要在您的项目中本地安装grunt (不使用-g安装)。 这和grunt-cli是你的命令行上的grunt命令不一样。

如果你有一个package.json文件,在你的项目文件夹中运行npm install