how to release localhost from Error: listen EADDRINUSE

前端 未结 28 2022
孤独总比滥情好
孤独总比滥情好 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:24

    ps -ef |grep node find app.js , kill pid of app.js

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

    I have node red installed on my Mac and my Raspberry Pi. Had the exact same problem and doing 'killall' didn't help. Once I shut down the Raspberry Pi and restarted my computer it worked fine.

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

    To kill node server first run this command in your terminal :

    1. top
    2. open another window then copy the server id from the previous window: PID number -9 kill so now you killed your node server try again to run your app.
    0 讨论(0)
  • 2020-11-28 18:28

    suppose your server is running on port 3000

    lsof -i tcp:3000
        COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
        node    11716 arun   11u  IPv6 159175      0t0  TCP *:3000 (LISTEN)
    

    after that use kill -9 <pid>

    in the above case sudo kill -9 11716

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

    Run:

    ps -ax | grep node
    

    You'll get something like:

    60778 ??         0:00.62 /usr/local/bin/node abc.js
    

    Then do:

    kill -9 60778
    
    0 讨论(0)
  • 2020-11-28 18:29

    use below command to kill a process running at a certain port - 3000 in this example below

    kill -9 $(lsof -t -i:3000)
    
    0 讨论(0)
提交回复
热议问题