【问题标题】:Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected identifier, Task "default" not found正在加载“Gruntfile.js”任务...错误>> SyntaxError:意外标识符,找不到任务“默认”
【发布时间】:2016-11-05 19:14:50
【问题描述】:

当我在终端中运行 grunt 时,我收到此错误消息,谁能告诉我为什么? 我收到一条错误消息:正在加载“Gruntfile.js”任务...错误

SyntaxError:意外的标识符 警告:找不到任务“默认”。使用 --force 继续。

module.exports = function(grunt){
require('load-grunt-tasks')(grunt);

var config = grunt.file.readYAML('Gruntconfig.yml');

grunt.initConfig({
    sass:{
        dist:{              
            src: config.scssDir+'style.scss',
            dest: config.cssDir+'style.css'
        }
    },
    concat:{
        dist:{
            src: config.jsSrcDir+'*.js',
            dest: config.jsConcatDir+'app.js'
        }
    },
    jshint:{
        options:{
            "eqeqeq": true
        }
        all:[
            'Gruntfile.js',
            config.jsSrcDir+"*.js"
        ]
    },
    watch:{
        sass:{
            files: config.scssDir+'**/*.scss',
            tasks:['sass']
        }
    }
});

grunt.registerTask('default',['jshint',
    'sass','concat','watch']);};

【问题讨论】:

    标签: gruntjs grunt-contrib-watch grunt-contrib-jshint


    【解决方案1】:

    这意味着它无法编译 gruntfile 中的 json。

    你缺少一个逗号

    jshint:{
        options:{
            "eqeqeq": true
        }<--- add comma here
        all:[
            'Gruntfile.js',
            config.jsSrcDir+"*.js"
        ]
    },
    

    【讨论】:

      猜你喜欢
      • 2015-04-05
      • 1970-01-01
      • 2019-11-29
      • 2014-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-02
      相关资源
      最近更新 更多