输入终端na" grunt"我收到了一个错误
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": {}
}
node -v" v0.10.26" npm -v" 1.4.3" grunt --version" grunt-cli v0.1.13 grunt v0.4.4"
让我知道我的代码有什么问题。谢谢你,祝你有个美好的一天。
答案 0 :(得分: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
我不确定为什么你的其他读者不工作,但这会让你哼哼!