2014-05-11 266 views
0

在終端吶「咕嚕」打字後,我得到了一個錯誤gruntfile.js [類型錯誤:未定義是不是一個函數]

Loading "Gruntfile.js" tasks...ERROR 
>> TypeError: undefined is not a function 
Warning: Task "default" not found. Use --force to continue. 

Aborted due to warnings. 

這裏我Gruntfile Gruntfile.js Gist

和我的package.json

{ 
    "name": "mintsflow", 
    "version": "0.0.0", 
    "title": "Mintsflow - Front End Worflow", 
    "author": "Ericson Luciano", 
    "website": "http://ericsonluciano.me", 
    "url": "http://mintsflow.ericsonluciano.me", 
    "description": "A personal and easy to use front end workflow using sass and grunt.js ", 
    "repository": { 
    "type": "git", 
    "url": "http://github.com/ericsonluciano/mintsflow.git" 
    }, 
    "license": "MIT", 
    "devDependencies": { 
    "bower": "~1.3.3", 
    "grunt": "~0.4.4", 
    "grunt-contrib-sass": "~0.7.3", 
    "grunt-contrib-concat": "~0.4.0", 
    "grunt-contrib-imagemin": "~0.7.0", 
    "grunt-contrib-connect": "~0.7.1", 
    "grunt-contrib-uglify": "~0.4.0", 
    "grunt-contrib-watch": "~0.6.1", 
    "grunt-contrib-clean": "~0.5.0", 
    "grunt-contrib-jshint": "~0.10.0", 
    "grunt-autoprefixer": "~0.7.3", 
    "grunt-open": "~0.2.3", 
    "grunt-notify": "~0.3.0", 
    "matchdep": "~0.3.0", 
    "grunt-contrib-cssmin": "~0.9.0", 
    "grunt-bower": "~0.13.1", 
    "connect-livereload": "~0.4.0", 
    "imagemin-mozjpeg": "~0.1.2" 
    }, 
    "dependencies": {} 
} 

節點-v 「v0.10.26」 NPM -v 「1.4.3」 咕嚕 --version 「咕嚕-CLI v0.1.13咕嚕v0.4.4」

讓我知道我的代碼有什麼問題。謝謝你,祝你有美好的一天。

回答

1

我通過將package.json閱讀器替換爲另一個閱讀器來實現它。

評論這個線路輸出,或從gruntfile.js一起卸下所有

require('matchdep').filterDev('grunt-*').forEach(grunt.loadNPMTasks); 

而是使用這個包的讀者,但grunt.initConfig(前添加一行{

require('load-grunt-tasks')(grunt); 

中當然它也添加到package.json

npm install --save-dev load-grunt-tasks 

我不知道爲什麼你的其他讀者是nt工作,但這會得到'呃呼!

+0

謝謝你的幫助。但我得到更多的錯誤:)但我會谷歌的問題。非常感謝 –

+1

我也遇到了一些錯誤,但是大多數人都抱怨缺少文件來做這些事情。我已經修復了 –

+0

。感謝您的幫助。榮譽 –

相關問題