Grunt'Build'错误

时间:2015-07-28 07:18:21

标签: gruntjs bower yeoman

我没有获得足够的解决方案来解决我在grunt build时遇到的错误 这是错误。

   Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'load-grunt-tasks'
>>     at Function.Module._resolveFilename (module.js:336:15)
>>     at Function.Module._load (module.js:278:25)
>>     at Module.require (module.js:365:17)
>>     at require (module.js:384:17)
>>     at Object.module.exports (/home/user/projects/misc/lfc-dev/project/Gruntfile.js:13:3)
>>     at loadTask (/home/user/projects/misc/lfc-dev/project/node_modules/grunt/lib/grunt/task.js:325:10)
>>     at Task.task.init (/home/user/projects/misc/lfc-dev/project/node_modules/grunt/lib/grunt/task.js:437:5)
>>     at Object.grunt.tasks (/home/user/projects/misc/lfc-dev/project/node_modules/grunt/lib/grunt.js:120:8)
>>     at Object.module.exports [as cli] (/home/user/projects/misc/lfc-dev/project/node_modules/grunt/lib/grunt/cli.js:38:9)
>>     at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:45:20)

Running tasks: build
Warning: Task "build" not found. Use --force to continue.

Aborted due to warnings.

我试过了, npm安装, npm install grunt, npm install grunt-cli

^^这些也是全球安装的。到目前为止,没有什么能帮助我。

2 个答案:

答案 0 :(得分:1)

日志显示Error: Cannot find module 'load-grunt-tasks'。你遗失了load-grunt-tasks。 Perhapse它不包含在packages.json

尝试

npm install --save-dev load-grunt-tasks

同时确保npm install之前未被中断。如果是,请尝试删除node_modules目录,然后再次尝试npm install

答案 1 :(得分:0)

我正在使用linux并要求以sudo身份运行命令。 然后繁荣......工作正常。