Javascript grunt contrib connect:connect在使用jit grunt和load grunt配置时未定义

Javascript grunt contrib connect:connect在使用jit grunt和load grunt配置时未定义,javascript,angularjs,gruntjs,grunt-contrib-connect,grunt-connect-proxy,Javascript,Angularjs,Gruntjs,Grunt Contrib Connect,Grunt Connect Proxy,我在package.json中安装了以下grunt插件: "grunt-connect-proxy": "^0.2.0", "grunt-contrib-connect": "^0.11.2", "grunt-contrib-watch": "^0.6.1", "jit-grunt": "^0.9.1", "load-grunt-config": "^0.17.2", "load-grunt-tasks": "^3.2.0" 以及以下grunt文件: 'use strict'; module

我在package.json中安装了以下grunt插件:

"grunt-connect-proxy": "^0.2.0",
"grunt-contrib-connect": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"jit-grunt": "^0.9.1",
"load-grunt-config": "^0.17.2",
"load-grunt-tasks": "^3.2.0"
以及以下grunt文件:

'use strict';

module.exports = function(grunt) {

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

 require('time-grunt')(grunt);

 require('load-grunt-config')(grunt, {
    loadGruntTasks: {
    pattern: ['grunt-*'],
    config: require('./package.json')
    },
    jitGrunt: true
});

 require('jit-grunt')(grunt, {
   pluginsRoot: '/grunt',
  'grunt-connect-proxy': 'grunt-connect-proxy',
   serve: 'tasks/serve.js'
 });

};
和以下连接contrib connect任务:

'use strict';

// The node js test server for serving client files
module.exports = function(grunt) {
  return {
    options: {
    port: 9000,
    hostname: 'localhost'
  },
  proxies: [{
     context: '/api', // the api pattern you need to proxy(i am going to proxy all the requests that are having a path as /api)
    host: 'localhost', // the backend server host ip
    port: 8080 // the backend server port
  }],
  livereload: {
    options: {
      open: true,
      middleware: function (connect, options) {
      grunt.log.write(JSON.stringify(connect)); // connect is undefined
      grunt.log.write(JSON.stringify(options)); // has values

      // custom middleware

      return [];
    }
  }
},
dist: {
  options: {
    open: true,
    base: 'dist'
  }
}
 };
}
问题是连接对象没有传递给中间件签名。这导致我的服务器内容无法正确显示。我提供一些静态内容,如

connect().use('/bower_components', connect.static('/bower_components'))
将其推送到中间件,与grunt contrib connect文档上的中间件示例没有太大区别:

有人有什么想法吗

可能的重复可能的重复