正在加载 "Gruntfile.js" 任务...在 运行 `grunt` 时出错

Loading "Gruntfile.js" tasks...ERROR while running `grunt`

我是 G运行t 世界的新手。

安装 g运行t-cli 和所有依赖项后,这是我的:Gruntfile.js

/*
        Grunt installation:
        -------------------
            npm install -g grunt-cli
            npm install -g grunt-init
            npm init (creates a `package.json` file)

        Project Dependencies:
        ---------------------
            npm install grunt --save-dev
            npm install grunt-contrib-concat --save-dev
            npm install grunt-contrib-watch --save-dev



        Example Usage:
        --------------
            grunt -v
            grunt release -v

*/


module.exports = function(grunt) {
    "use strict";

    grunt.initConfig({

        concat: {

            js: {
                src: ['js/bootstrap.min.js', 'js/jquery-1.10.2.min.js'],
                dest: 'build/js/scripts.js'
            },

            css: {
                src: ['css/bootstrap.min.css', 'css/font-awesome.min.css'],
                dest: 'build/css/styles.css'
            }
        },

        watch: {

            js: {
                files: ['js/**/*.js'],
                task: ['concat:js']
            },

            css: {
                files: ['css/**/*.css'],
                task: ['concat:css']
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasksNpmTasks('grunt-contrib-watch');
    grunt.registerTask('default', ['concat', 'watch']);

};

结果

现在是测试部分,我尝试了 运行 grunt,我不断得到:

Loading "Gruntfile.js" tasks...ERROR
>> TypeError: undefined is not a function
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

有人可以告诉我我做错了什么吗?

由于拼写错误,default 目标似乎未正确创建。尝试重命名

grunt.loadNpmTasksNpmTasks('grunt-contrib-watch');

grunt.loadNpmTasks('grunt-contrib-watch');

遇到过类似的问题并在安装节点模块的地方尝试了以下命令,这为我解决了问题:

npm install --unsafe-perm