简体   繁体   English

当我运行Grunt时说没有找到“默认”任务时,我得到警告

[英]I am getting warning when I run Grunt saying 'default' task not found

I am new to Grunt. 我是Grunt的新手。 Whenever I have run the Grunt command it gives this warning and aborts. 每当我运行Grunt命令时,它都会发出此警告并中止。 The warning is given below. 警告如下。

Loading "Gruntfile.js" tasks...ERROR 正在加载“ Gruntfile.js”任务...错误

TypeError: Object # has no method 'loadNpmtasks' Warning: Task "default" not found. TypeError:对象#没有方法'loadNpmtasks'警告:未找到任务“默认”。 Use --force to continue. 使用--force继续。

Aborted due to warnings. 由于警告而中止。

I know this type of question has been asked before. 我知道这类问题以前曾被问过。 I have seen those answers. 我已经看到了这些答案。 All of them have some syntax error. 它们都有语法错误。 I can't find anything in mine. 我在我身上找不到任何东西。 My code has been given below. 我的代码已在下面给出。

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']);
};

Your methods name are wrong, the t from tasks is lowercase instead of uppercase. 您的方法名称错误,任务中的t是小写而不是大写。

loadNpmtasks should be loadNpmTasks and registertasks should be registerTasks loadNpmtasks应该是loadNpmTasksregistertasks应该是registerTasks

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

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