【问题标题】:Gruntfile fails with Warning: Task "default" not foundGruntfile 失败并显示警告:找不到任务“默认”
【发布时间】:2017-02-09 11:55:04
【问题描述】:
  1. 这是我的 gruntfile。
  2. 我运行 $ grunt default
  3. 实际上我想在某个端口上升级我的 index.html 并希望它直接在 chrom 中打开

      module.exports = function(grunt) {
      grunt.initConfig({
     connect: {
        server: {
          options: {
            port: 9001,
            base: {
              path: 'Dev',
              options: {
                index: 'index.html',
                maxAge: 300000
              }
            }
          }
        }
      },
       open: {
        delayed: {
          path: 'http://localhost:9001'
          app: 'Google Chrome'
          options: {
            openOn: 'serverListening'
          }
        }
      }     
      });
    grunt.registerTask('default', ['connect', 'open']);
    };
    

【问题讨论】:

    标签: gruntjs grunt-contrib-watch long-running-processes


    【解决方案1】:

    你需要加载任务:

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

    【讨论】:

      猜你喜欢
      • 2013-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-25
      相关资源
      最近更新 更多