繁体   English   中英

使用grunt-vows时grunt.js引发错误

[英]grunt.js throws error when using grunt-vows

我在以下gruntfile中使用grunt-vows( https://github.com/CMTegner/grunt-vows ):

module.exports = function(grunt) {  
  // Project configuration.  
  grunt.loadNpmTasks("grunt-vows");  
  grunt.initConfig({  
    vows: {  
      all: {  
        options: {  
          reporter: "spec",  
          verbose: true,  
          silent: false,  
          colors: true,  
          isolate: false,  
          coverage: "json"  
        },  
        src: ["test/*.js"]  
      }  
    }  
  });  
  // Default task.  
  grunt.registerTask('default', 'vows');  
};  

并在运行grunt时收到以下错误:
TypeError: Object #<Object> has no method 'options'
at Object.<anonymous> (/home/dan/playlist/node_modules/grunt-vows/tasks/vows.js:32:33)
at Object.<anonymous> (/usr/lib/node_modules/grunt/lib/grunt/task.js:109:15)
at Object.thisTask.fn (/usr/lib/node_modules/grunt/lib/grunt/task.js:58:16)

我确信自己在某个地方犯了一个简单的错误,gruntfile中是否有任何异常?

提前致谢,

这是您本地安装的咕unt声和此模块的一些兼容性问题!

如果您安装了grunt 0.3.x(我认为是您的问题),则可以使用此插件的旧版本(应为grunt-vows@0.3.1或更旧版本)。

可能最好的办法是将本地安装的grunt升级到0.4.0(请参阅此处的迁移指南: http : //gruntjs.com/upgrading-from-0.3-to-0.4 ),因为您会遇到此问题如果您想包括新的grunt插件,那么很多。

当然,这将在已经存在的gruntfiles中添加一些其他工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM