node.js express socket.io port 3000 in use

后端 未结 8 443
南笙
南笙 2021-02-02 16:33

I\'ve been following this(http://socket.io/get-started/chat/) tutorial on how to make a simple chat application using socket.io.

I tried to however use Express to create

8条回答
  •  抹茶落季
    2021-02-02 17:06

    I solved it by this:

    npm install shelljs

    and add code for kill nodejs process before start listen port

    var shell = require('shelljs');
    shell.exec("pkill nodejs");
    shell.exec("pkill node");
    
    /* Make the http server listen on port 3000. */
    http.listen(3000, function(){
     console.log('listening on *:3000');
    });
    

提交回复
热议问题