How to fix Error: listen EADDRINUSE while using nodejs?

前端 未结 30 3195
执念已碎
执念已碎 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 06:52

    Just a head's up, Skype will sometimes listen on port 80 and therefore cause this error if you try to listen on port 80 from Node.js or any other app.

    You can turn off that behaviour in Skype by accessing the options and clicking Advanced -> Connection -> Use port 80 (Untick this)

    Turn off Skype port 80 usage

    P.S. After making that change, don't forget to restart Skype!

    0 讨论(0)
  • 2020-11-22 06:52

    Your application is already running on that port 8080 . Use this code to kill the port and run your code again

    sudo lsof -t -i tcp:8080 | xargs kill -9
    
    0 讨论(0)
  • 2020-11-22 06:52
    lsof -i:3000;
    kill -9 $(lsof -t -i:3000);
    // 3000 is a your port
    // This "lsof -i:3000;" command will show PID 
    kill PID 
    ex: kill 129393
    
    0 讨论(0)
  • 2020-11-22 06:52

    sudo kill $(sudo lsof -t -i:80)

    for force kill

    sudo kill -9 $(sudo lsof -t -i:80)

    use above cmd to kill particular port and then run your server

    0 讨论(0)
  • 2020-11-22 06:55

    What really helped for me was:

    killall -9 node
    

    But this will kill a system process.

    With

    ps ax
    

    you can check if it worked.

    0 讨论(0)
  • 2020-11-22 06:58

    You should try killing the process that is listening on port 80.

    Killall will kill all the node apps running. You might not want to do that. With this command you can kill only the one app that is listening on a known port.

    If using unix try this command:

    sudo fuser -k 80/tcp    
    
    0 讨论(0)
提交回复
热议问题