【问题标题】:I am getting warning when I run Grunt saying 'default' task not found当我运行 Grunt 说“未找到默认”任务时收到警告
【发布时间】:2014-08-27 00:05:08
【问题描述】:

我是 Grunt 的新手。每当我运行 Grunt 命令时,它都会发出此警告并中止。警告如下。

正在加载“Gruntfile.js”任务...错误

TypeError: Object # has no method 'loadNpmtasks' 警告:找不到任务“默认”。使用 --force 继续。

由于警告而中止。

我知道以前有人问过这类问题。我已经看到了那些答案。它们都有一些语法错误。我在我的里面找不到任何东西。下面给出了我的代码。

module.exports = function(grunt){
    grunt.initConfig({
        pkg : grunt.file.readJSON('package.json'),
        concat : {
            dist : {
                src : [
                    'something.js',
                    'anything.js'
                ], dest : 'new.js'
            }
        }
    });

    grunt.loadNpmtasks('grunt-contrib-concat');
    grunt.registertasks('default', ['concat']);
};

【问题讨论】:

    标签: javascript gruntjs grunt-contrib-concat


    【解决方案1】:

    您的方法名称错误,tasks 中的t 是小写而不是大写。

    loadNpmtasks 应该是 loadNpmTasks 和 registertasks 应该是 registerTasks

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-28
      • 2013-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多