【问题标题】:grunt.js throws error when using grunt-vows使用 grunt-vows 时 grunt.js 抛出错误
【发布时间】:2013-03-25 01:30:48
【问题描述】:

我在以下 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 中是否有什么不合适的地方?

提前致谢,

【问题讨论】:

    标签: node.js gruntjs vows


    【解决方案1】:

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

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

    您可以做的最好的事情可能是将本地安装的 grunt 升级到 0.4.0(请参阅此处的迁移指南:http://gruntjs.com/upgrading-from-0.3-to-0.4),因为如果您想包含新的 grunt-plugins,您将经常遇到此问题.

    当然,这会在现有的 gruntfiles 中添加一些额外的工作

    【讨论】:

    • 正是问题:) 谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2014-06-23
    相关资源
    最近更新 更多