Gruntjs Grunt connect的寿命不足以让我测试它

Gruntjs Grunt connect的寿命不足以让我测试它,gruntjs,grunt-contrib-connect,Gruntjs,Grunt Contrib Connect,当我尝试使用Grunt为我创建一个服务器时,它会很快关闭,并且不会给我一个转到浏览器并测试它的更改 这是我的整个Grunt文件: module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.initConfig({ connect: {

当我尝试使用Grunt为我创建一个服务器时,它会很快关闭,并且不会给我一个转到浏览器并测试它的更改

这是我的整个Grunt文件:

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.initConfig({
        connect: {
            serve: {
                options: {
                    port: 8081,
                    base: '/',
                    hostname: '*',
                    debug: true
                }
            }
        }
    });
    grunt.registerTask('default', ['connect']);
}
当我运行它时,它不会出错:

C:\Users\Imray\my-sandbox>grunt
Running "connect:keepalive" (connect) task
Started connect web server on http://0.0.0.0:8000

Running "connect:serve" (connect) task
Started connect web server on http://0.0.0.0:8081

您有专用于此的
keepalive
设置:

grunt.initConfig({
        connect: {
            serve: {
                options: {
                    keepalive: true,
                    port: 8081,
                    base: '/',
                    hostname: '*',
                    debug: true
                }
            }
        }
    });

谢谢,但是为什么要添加
keepalive
?这不是很明显吗?谁想要一台运行3秒钟的服务器?