I recently identified an issue where, if the local development page is left open in the browser, it continues attempting to connect to the local development server via live-reload. This behavior can cause the command-line process to fail or time out.
localhost
tab still open…λ npm start
> gatsby develop -o
> Running Dev Command “gatsby develop --port $PORT”
> Ready! Available at http://localhost:3000
Error: socket hang up
at connResetException (node:internal/errors:683:14)
at Socket.socketOnEnd (node:_http_client:471:23)
at Socket.emit (node:events:406:35)
at Socket.emit (node:domain:470:12)
at endReadableNT (node:internal/streams/readable:1329:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Pinging the local development server before it’s fully ready can cause a socket hang-up error. Whenever I encounter this issue while attempting to start my local server, I promptly close any browser tabs directed at localhost
, and voilà, the problem is resolved!