简体   繁体   中英

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

I am new to Grunt. Whenever I have run the Grunt command it gives this warning and aborts. The warning is given below.

Loading "Gruntfile.js" tasks...ERROR

TypeError: Object # has no method 'loadNpmtasks' Warning: Task "default" not found. Use --force to continue.

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.

loadNpmtasks should be loadNpmTasks and registertasks should be registerTasks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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