找不到多个Grunt任务

时间:2014-01-10 16:28:12

标签: gruntjs yeoman

我正在尝试构建一个yeoman生成器并使用教程作为指导 http://yeoman.io/generators.html#writing-your-first-generator

我从引用的gist复制了Gruntfile.js并将其放入我的生成器的模板目录中。当我生成项目时,我运行

 npm install && bower install

然后

 grunt test

<击>

<击>
  
    

找不到本地Npm模块“grunt-template-jasmine-requirejs”。它安装了吗?          警告:找不到任务“并发:测试”。使用--force继续。

  
 Aborted due to warnings.


 Execution Time (2014-01-10 16:19:20 UTC)
 loading tasks  3ms
 ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 50%
 test           2ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 33%
 Total 6ms

<击>

我不清楚为什么Grunt并发:找不到测试。 Grunt找到了clean:test任务。我尝试评论并发任务,除了“干净”之外,没有找到“test”的其他任务。这是任务列表

       grunt.registerTask('test',[         “干净:服务器”,         “并发:测试”,         'autoprefixer',         “连接:测试”,         “业力”        ]);

好点jakerella我现在看到我在我的自动生成器中使用了不同的grunt文件然后我打算。当我用yeoman教程中引用的gist替换Gruntfile.js时,我遇到了与其他任务不同的问题。它说没有找到“手表”。

$ ls node_modules/
bower                   grunt-contrib-compass           grunt-contrib-jshint            grunt-template-jasmine-requirejs
connect-livereload          grunt-contrib-concat            grunt-contrib-jst           grunt-usemin
grunt                   grunt-contrib-connect           grunt-contrib-livereload        load-grunt-tasks
grunt-bower-requirejs           grunt-contrib-copy          grunt-contrib-requirejs         matchdep
grunt-connect-proxy         grunt-contrib-cssmin            grunt-contrib-uglify            moment
grunt-contrib-clean         grunt-contrib-htmlmin           grunt-open              time-grunt
grunt-contrib-coffee            grunt-contrib-imagemin          grunt-regarde
$ grunt server
>> Local Npm module "grunt-template-jasmine-requirejs" not found. Is it installed?
Warning: Task "watch" not found. Use --force to continue.

Aborted due to warnings.
$ 

2 个答案:

答案 0 :(得分:4)

我遇到了同样的问题。我通过运行解决了它: npm install grunt-x --save-devx替换为丢失任务的名称,直到完成为止。

顺便说一下,我首先尝试了npm install -g grunt-x,但是没有用。

答案 1 :(得分:3)

在确定依赖关系的一些工作之后,我能够在复制整个基础应用程序目录后使其工作,然后使用foundation5生成器的index.js文件列表从模板目录中复制,作为其他资源的指南这是我的发电机所需要的。我认为对于任何试图重新利用现有生成器并帮助识别Grunt依赖关系的人来说,这可能是一种有用的方式。

相关问题