Javascript 找不到错误任务Gruntjs
我认为Javascript 找不到错误任务Gruntjs,javascript,gruntjs,Javascript,Gruntjs,我认为grunt.initConfig中的内容是一种有效的json格式,那么为什么在执行cli时会出现此错误: module.exports = function(grunt){ grunt.initConfig({ maintain:{ src: 'js/*.js', dist:'controller.min.js' } }); grunt.registerTask('de
grunt.initConfig
中的内容是一种有效的json格式,那么为什么在执行cli时会出现此错误:
module.exports = function(grunt){
grunt.initConfig({
maintain:{
src: 'js/*.js',
dist:'controller.min.js'
}
});
grunt.registerTask('default', ["maintain"]);
};
在我的package.json中,我有:
D:\Angular_Work_Space\GruntPratice>grunt
Warning: Task "maintain" not found. Use --force to continue.
Aborted due to warnings.
这里有什么问题。导出任务“维护”的确切含义是什么。package.json中没有任何内容。@steveax,感谢您的重播,实际上在示例中它类似于min:{..},但我觉得它是用户定义的,所以我提到它是mainte:{..},这里我试图缩小js文件夹中的所有.js文件,并将其命名为“controller.min.js”,是否有什么问题。Grunt插件。您也可以直接在GrunFile中注册任务。您提供的代码中没有注册名为“维护”的任务。
{
"name": "my-project-name",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-uglify": "~0.2.2"
}
}