gatsby: develop command crashing when default 8000 port in use,
I’ve bumped into a bug only in the last day or two and I’m not sure what update might have caused the change. When running npx gatsby develop
and I already have something running on port 8000, I’d get the standard response: Would you like to run the app at another port instead?
but now the command crashes.
I can still run my server on another port with npx gatsby develop -p 8001
and I so far assume this issue won’t interfere with anything else.
I’ve not found this specific bug reported but there does appear to be recent activity around other yoga-layout-prebuilt bugs…
Here’s the error:
/Users/Antonio/code/gatsby-starter-blog/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
Error: listen EADDRINUSE: address already in use :::8000
at Server.setupListenHandle [as _listen2] (net.js:1313:16)
at listenInCluster (net.js:1361:12)
at Server.listen (net.js:1447:7)
at startDevelopProxy (/Users/Antonio/code/gatsby-starter-blog/node_modules/gatsby/dist/utils/develop-proxy.js:79:10)
at module.exports (/Users/Antonio/code/gatsby-starter-blog/node_modules/gatsby/dist/commands/develop.js:133:53)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1340:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 8000
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 18 (11 by maintainers)
Made a PR for you all, hope that helps, tested and it works 😃
kill -9 $(lsof -i TCP:8000 | grep LISTEN | awk ‘{print $2}’)
This works me.
this works for me: sudo lsof -i tcp:8000 and then simply ran kill -9 PID
I ran into an issue on macOS where running
gatsby develop
after hittingctrl+c
gave me a similar error message that the port is already being used. Yes the temporary fix of runninggatsby develop -p 8001
on any other unoccupied port works. But my 2013 macbook pro was using alot of power in the background (233 energy impact when viewing on activity monitor).I searched for the PID using
sudo lsof -i tcp:8000
and then simply rankill -p $PID
to kill the connections to port 8000. After doing so, the activity monitor showed regular VS code energy consumption. I then rangatsby develop
and the development build was viewable in browser on port 8000 like expected! Hope this helps someone 😄This temporary fix helped me continue my work.
gatsby develop -p 8001
I can confirm i experienced the same issue, latest version of gatsby-cli.