how to release localhost from Error: listen EADDRINUSE

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

    When you get an error Error: listen EADDRINUSE,

    Try running the following shell commands:

    netstat -a -o | grep 8080
    taskkill /F /PID 6204
    

    I greped for 8080, because I know my server is running on port 8080. (static tells me when I start it: 'serving "." at http://127.0.0.1:8080'.) You might have to search for a different port.

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

    Check the Process ID

    sudo lsof -i:8081

    Than kill the particular Process

    sudo kill -9 2925

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

    You are getting the error EADDRINUSE because the port, which your application wants to use, is occupied by another process. To release this port, you need to terminate the occupying process.

    Since you are on Windows, you can terminate the process using the command prompt (cmd). With the cmd you can discover the process ID (PID) of the blocking application. You will need the PID in order to terminate / kill the process.

    Here is a step-by-step guide...

    1. Find all processes which are running on a specified port (in this example, Port is "3000"):

      netstat -ano | find ":3000 "

    2. The netstat command will list up all processes running on the specified port. In the last column of the netstat results you can see the PIDs (in this example, PID is "8308"). You can find out more about a specific PID by running the following command:

      tasklist /fi "pid eq 8308"

    3. If you want to terminate a process, you can do that with the following command by using its PID (in this example, PID is "8308"):

      taskkill /pid 8308 /f

    Screenshot

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

    It means the address you are trying to bind the server to is in use. Try another port or close the program using that port.

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

    You will need to kill the port by trying to use the following command on the terminal

    $ sudo killall -9 nodejs
    
    0 讨论(0)
  • 2020-11-28 18:18

    When you get an error

    Error: listen EADDRINUSE

    Open command prompt and type the following instructions:

    netstat -a -o | grep 8080
    taskkill /F /PID** <*ur Process ID no*>
    

    after that restart phone gap interface.

    If you want to know which process ID phonegap is using, open TASK MANAGER and look at the Column heading PID and find the PID no.

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