簡體   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