how to release localhost from Error: listen EADDRINUSE

前端 未结 28 2047
孤独总比滥情好
孤独总比滥情好 2020-11-28 17:53

i am testing a server written in nodejs on windows 7 and when i try to run the tester in the command line i get the following error

Error: listen EADDRINUSE
         


        
相关标签:
28条回答
  • 2020-11-28 18:39

    I created 2 servers, listening on same port 8081, running from same code, while learning

    1st server creation shud have worked 2nd server creation failed with EADDRINUSE

    node.js callback delays might be reason behind neither worked, or 2nd server creation had exception, and program exited, so 1st server is also closed

    2 server issue hint, I got from: How to fix Error: listen EADDRINUSE while using nodejs?

    0 讨论(0)
  • 2020-11-28 18:39

    It may be possible that you have tried to run the npm start command in two different tabs .you cant run npm start when it is already running in some tab.check it once .

    0 讨论(0)
  • 2020-11-28 18:39

    simply kill the node as pkill -9 node in terminal of ubantu than start node

    0 讨论(0)
  • 2020-11-28 18:40

    I used the command netstat -ano | grep "portnumber" in order to list out the port number/PID for that process. Then, you can use taskkill -f //pid 111111 to kill the process, last value being the pid you find from the first command.

    One problem I run into at times is node respawning even after killing the process, so I have to use the good old task manager to manually kill the node process.

    0 讨论(0)
提交回复
热议问题