Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt server can't be connected <gruntjs>

module.exports = function(grunt) {

  // Project configuration.
    grunt.initConfig({
      server: {
        port: 8888,
        base: '.'
      }
    });

};

C:\Program Files\nodejs\test\grunt>
C:\Program Files\nodejs\test\grunt>grunt server
Running "server" task
Starting static web server on port 8888.

Done, without errors.

but can't connected by input [http://127.0.0.1:8888][1] in browsers ! jiong~

How about to fix this problem in windows or unix ?

like image 668
user1817849 Avatar asked Nov 12 '12 11:11

user1817849


1 Answers

In grunt 0.4 combined with grunt-contrib-connect you can run a long running server by using the keepalive argument: grunt connect:target:keepalive or define it as an option in your config:

grunt.initConfig({
  connect: {
        target:{
            options: {
                port: 9001,
                keepalive: true
            }
        }
    }
});
like image 64
Sindre Sorhus Avatar answered Oct 03 '22 19:10

Sindre Sorhus