簡體   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