How to fix Error: listen EADDRINUSE while using nodejs?

前端 未结 30 3217
执念已碎
执念已碎 2020-11-22 06:44

If I run a server with the port 80, and I try to use xmlHTTPrequest i get this error: Error: listen EADDRINUSE

Why is it problem for nodejs, if I want t

30条回答
  •  情歌与酒
    2020-11-22 07:15

    Another thing that can give this error, is two HTTP servers in the same node code. I was updating some Express 2 to Express 3 code, and had this...

    http.createServer(app).listen(app.get('port'), function(){            
      console.log('Express server listening on port ' + app.get('port')); 
    });        
    
    // tons of shit.
    
    http.createServer(app).listen(app.get('port'), function(){            
      console.log('Express server listening on port ' + app.get('port')); 
    });                                                                   
    

    And, it triggered this error.

提交回复
热议问题