繁体   English   中英

咕unt声:找不到任务“默认”

[英]Grunt: Task “default” not found

我正在尝试设置一些简单的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.

非常感谢!

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

那可能是你的问题吗?

好了,以前没赶上这一点,但它module.exportsexports.module

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM