Grunt:未找到任务“默认”

时间:2014-07-19 19:16:12

标签: javascript node.js gruntjs grunt-contrib-uglify grunt-cli

我正在尝试设置一些简单的Grunt任务,但在运行它们时,我在终端“警告:任务”默认“未找到”中收到警告。

我已将gruntfile简化为一个任务,以减少由语法错误引起的机会,但我仍然得到相同的警告......

gruntfile.js

exports.module = function (grunt) {
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
        build: {
            files: {
                '/public/scripts/test.min,js' : ['/public/scripts/test.js']
            }
        }
    }
});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);

};

的package.json

 {
      "name": "CustomersCRUD",
      "version": "0.0.1",
      "description": "Customer CRUD Application",
      "main": "app.js",
      "scripts": {
          "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Dan Hutchinson",
      "license": "ISC",
      "dependencies": {
        "express": "^4.6.1",
        "serve-favicon": "^2.0.1"
      },
      "devDependencies": {
         "grunt": "^0.4.5",
         "grunt-contrib-uglify": "^0.5.0"
      }
     }

发出警告

Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

非常感谢!

2 个答案:

答案 0 :(得分:1)

我在这里看到一个逗号:'/public/scripts/test.min,js'

这可能是你的问题吗?

答案 1 :(得分:1)

好的,之前没有抓住这个,但它是module.exports而不是exports.module

那应该解决它。另外,我认为您的文件引用不需要/