Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: listen EADDRINUSE 0.0.0.0:8000 but no other process is running #334

Closed
crucialfelix opened this issue Jun 16, 2016 · 5 comments
Closed

Comments

@crucialfelix
Copy link

crucialfelix commented Jun 16, 2016

This is a bit curious.

  1. Start up another webpack project that is serving on 0.0.0.0:8000
  2. Try to run gatsby. It correctly complains of EADDRINUSE and hangs.
  3. Ctrl-c gatsby
  4. Ctrl-c the other webpack
  5. Try to run gatsby again. Still complains of EADDRINUSE and hangs

Checking htop there are no other processes running. But something (perhaps gatsby at step 2) is still hanging onto this port.

The only thing that works is to restart the whole computer.

> gatsby develop

{ [Error: listen EADDRINUSE 0.0.0.0:8000]
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '0.0.0.0',
  port: 8000 }
Listening at: http://0.0.0.0:8000
^C

Notice how it says it is listening, even though it got an EADDRINUSE error.

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Jun 16, 2016

Thanks for the error report! I agree this is a sucky UX + you're right, the dev server should not start listening if there's an error.

I just created a PR to fix this #335. In the above scenario, Gatsby now outputs an error message like the following then quits.

We were unable to start Gatsby on port 8000 as there's already a process
listening on that port (PID: 43337). You can either use a different port
(e.g. gatsby develop --port 8001) or stop the process already listening
on your desired port.

@NogsMPLS
Copy link
Contributor

+1000000 for including PID in the error message. bookmarking this so i can come back to it later for my own stuff.

@crucialfelix
Copy link
Author

Sounds good. Thanks !

On Thu, Jun 16, 2016 at 8:43 PM Kyle Mathews [email protected]
wrote:

Thanks for the error report! I agree this is a sucky UX + you're right,
the dev server should not start listening if there's an error.

I just created a PR to fix this #335
#335. In the above scenario,
Gatsby now outputs an error message like the following then quits.

We were unable to start Gatsby on port 8000 as there's already a process
listening on that port (PID: 43337). You can either use a different port
(e.g. gatsby develop --port 8001) or stop the process already listening
on your desired port.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#334 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AANWci0ZmDBtiQltcQjCjApnGfyTYCmTks5qMZlZgaJpZM4I3Ka1
.

https://twitter.com/crucialfelix
https://medium.com/@crucialfelix
http://www.mattermind.com/

@KyleAMathews
Copy link
Contributor

Just published 0.11.5 🎉 🎉 🎉

Thanks for raising the issue @crucialfelix! This has always kinda bothered me but your pushing crystalized a good solution. Cheers and happy Gatsbing.

@paulclifford
Copy link

Instead of restarting your computer, you can try this. At the terminal:

  1. ps copy the PID of the gatsby develop server to your clipboard
  2. kill -HUP [paste PID here]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants