Skip to content

Don't start develop server if port in use & show friendlier error message

Choose a tag to compare

@KyleAMathews KyleAMathews released this 16 Jun 22:20
· 21267 commits to master since this release

@crucialfelix raised two issues in #334 — a) it's hard to figure out to do when Node throws up it's cryptic EADDRINUSE error and b) Gatsby doesn't die as it should when it hits that but pretends it's running.

In #335 I fixed both where gatsby develop now dies when the server can't start (for whatever reason) and when Node throws a EADDRINUSE error, we catch that, find the process that is listening on that port and show this error message:

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.