7

无论我尝试运行什么任务,都会发生这种情况。使用--verbose标志运行时,我得到:

初始化命令行选项:--verbose

阅读“Gruntfile.js” Gruntfile...OK

注册 Gruntfile 任务。加载“Gruntfile.js”任务...确定

没有任务被注册或取消注册。

这是 Gruntfile:

module.export = function (grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        karma_coveralls: {
            options: {
                coverage_dir: 'coverage'
            }
        },
        jshint: {
            files: ['app/js/**/*.js', 'Gruntfile.js'],
            options: grunt.file.readJSON('.jshintrc')
        },
        concat: {
            options: {
                seperator: ';'
            },
            dist: {
                src: ['app/js/**/*.js'],
                dest: 'dist/app/js/<%pkg.name%>.js'
            }
        },
        exec: {
            instrument: {
                cmd: function () {
                    return 'istanbul instrument app/js -o app/instrumentjs';
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-karma-coveralls');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.registerTask('coverage', ['coveralls']);
    grunt.registerTask('default', ['jshint']);
    grunt.registerTask('instrument', ['exec: instrument']);
    grunt.registerTask('concat', ['concat']);

};

任何想法我做错了什么?

咕噜版本:

grunt-cli v0.1.9 grunt v0.4.1

4

2 回答 2

19

在你的 Gruntfile 中,module.export应该是module.exports.

于 2013-10-28T13:17:17.570 回答
0

在 Gruntfile.js 中调用 grunt.loadNpmTasks 时检查 /node 模块的路径

于 2017-08-28T09:03:17.017 回答