javascriptgruntjsgrunt-contrib-concat

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

Solution

  • Your methods name are wrong, the t from tasks is lowercase instead of uppercase.

    loadNpmtasks should be loadNpmTasks and registertasks should be registerTasks