Node.js unhandled 'error' event

后端 未结 6 1950
广开言路
广开言路 2021-02-02 08:14

I have written a simple code and save it in file try.js .

var http = require(\'http\');
var makeRequest = function(message) {
  var options = {
    host: \'loca         


        
6条回答
  •  青春惊慌失措
    2021-02-02 08:24

    Another server is running on same port 8080, so you need to kill and start your instance.

    find running instance

    $ netstat -nlp | grep 8080
    
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    tcp6       0      0 :::8881                 :::*                    LISTEN      28207/node    
    

    kill existing server instance using pid

    $ kill -9 28207
    

    start instance

    $ node server.js 
    

提交回复
热议问题