首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Grunt 'Build‘错误

问Grunt 'Build‘错误
EN

Stack Overflow用户
提问于 2015-07-28 15:18:21
回答 2查看 3.6K关注 0票数 1

我没有得到足够的解决方案来解决我遇到的错误,when do grunt build this is the error。

代码语言:javascript
复制
   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 install,npm install grunt,npm install grunt-cli

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

EN

回答 2

Stack Overflow用户

发布于 2015-07-28 19:50:59

日志上写的是Error: Cannot find module 'load-grunt-tasks'。您缺少load-grunt-tasks。可能它不包含在packages.json中

试一试

代码语言:javascript
复制
npm install --save-dev load-grunt-tasks

另外,还要确保npm install之前没有被中断。如果是,请尝试删除node_modules目录,然后再次尝试npm install。

票数 1
EN

Stack Overflow用户

发布于 2015-07-28 19:51:37

我使用的是linux,它请求以sudo的身份运行命令。然后轰隆一声。工作得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31669763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档