Gruntfile失败,并显示Warning:Task“default”not found

问题描述:

  1. 这是我的grunt文件。
  2. 我运行$咕噜默认
  3. 实际工作中,我想我的index.html的一些端口上,并希望它在CHROM打开直接Gruntfile失败,并显示Warning:Task“default”not found

    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']); 
    }; 
    

你需要下载任务:

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