Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 警告:任务“;“违约”;找不到_Angularjs_Gruntjs_Gruntfile - Fatal编程技术网

Angularjs 警告:任务“;“违约”;找不到

Angularjs 警告:任务“;“违约”;找不到,angularjs,gruntjs,gruntfile,Angularjs,Gruntjs,Gruntfile,这是我的grunfile.js module.exports = function(grunt) { require('logfile-grunt')(grunt, { filePath: './logs/grunt.log', clearlogFile: true }); grunt.initConfig({ // pkg: grunt.file.readJSON('package.json'), connect: { server: {

这是我的
grunfile.js

module.exports = function(grunt) {
  require('logfile-grunt')(grunt, {
    filePath: './logs/grunt.log',
    clearlogFile: true
  });
  grunt.initConfig({
    // pkg: grunt.file.readJSON('package.json'),
    connect: {
      server: {
        options: {
          port: 9001,
          hostname: '*',
          middleware: function(connect, options) {
            return [
              function(req, res, next) {
                res.setHeader('X-UA-Compatible', 'IE-edge');
                next();
              }
              connect.static('project')
            ]
          }
        }
      }
    },
    watch: {
      options: {
        livereload: true
      },
      files: ['project/**/*.js', 'project/**/*.html', 'project/**/*.css'],
      task: []
    }
  });

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

  grunt.registerTask('default', ['connect:server', 'watch']);
};


您忘记在返回数组中写入coma

return [
    function(req, res, next) {
        res.setHeader('X-UA-Compatible', 'IE-edge');
        next();
     },
     connect.static('project')
]

我知道这与您的答案不太一致,但还有一些其他捆绑包/任务运行程序与angular一起工作,使开发服务器和env的方式比grunt或gulp更易于使用。例如网页包装或浏览。