This might be related to https://github.com/gatsbyjs/gatsby/issues/14990 and https://github.com/gatsbyjs/gatsby/issues/15441.
After environment set up, I created new Gatsby project with Hello World starter. I changed into the directory and ran gatsby develop.
The process completed to show me the localhost URL but immediately returned an error and quit the process.
I previously tried deleting node_modules and reinstalling packages with npm i but same thing happens.
gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-worldcd hello-worldgatsby developWeb server should run to allow localhost:8000 to run in browser
I'll paste the last lines including localhost.
You can now view gatsby-starter-hello-world in the browser.
โ
http://localhost:8000/
โ
View GraphiQL, an in-browser IDE, to explore your site's data and schema
โ
http://localhost:8000/___graphql
โ
Note that the development build is not optimized.
To create a production build, use npm run build
โ
โ ๏ฝขwdm๏ฝฃ:
โน ๏ฝขwdm๏ฝฃ: Compiled with warnings.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ0 pages gatsby-starter-hello-world
ERROR
UNHANDLED REJECTION request to http://localhost:8000/___graphql failed, reason: socket hang up
FetchError: request to http://localhost:8000/___graphql failed, reason: socket hang up
- index.js:1455 ClientRequest.<anonymous>
[gatsby]/[gatsby-cli]/[node-fetch]/lib/index.js:1455:11
- next_tick.js:63 process._tickCallback
internal/process/next_tick.js:63:19
Windows 10 1903 Build 18362.295
System:
OS: Linux 4.4 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
Yarn: 1.17.3 - ~/.nvm/versions/node/v10.16.3/bin/yarn
npm: 6.10.3 - ~/.nvm/versions/node/v10.16.3/bin/npm
Languages:
Python: 2.7.15+ - /usr/bin/python
npmGlobalPackages:
gatsby-cli: 2.7.31
I'm on the same windows version as you and can't reproduce this issue on WSL. I have a feeling that it's a firewall issue. Could you try again with antivirus/firewalls disabled?
I have the exact same issue, and I'm using WSL. Sometimes (rarely) it happens in the same way as @asuh reported, right after compilation is complete. Most of the time however it happens some time (from a few minutes, to a few hours) after starting the development server.
I've tried disabling the firewall, but it still persists.
I'm running the same build as both you.
System:
OS: Linux 4.4 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 10.16.2 - /usr/local/bin/node
npm: 6.10.3 - /usr/local/bin/npm
Languages:
Python: 2.7.15+ - /usr/bin/python
npmPackages:
gatsby: ^2.13.67 => 2.13.67
gatsby-image: ^2.2.8 => 2.2.8
gatsby-plugin-alias-imports: ^1.0.5 => 1.0.5
gatsby-plugin-create-client-paths: ^2.1.3 => 2.1.3
gatsby-plugin-eslint: ^2.0.5 => 2.0.5
gatsby-plugin-layout: ^1.1.3 => 1.1.3
gatsby-plugin-preconnect: ^1.0.5 => 1.0.5
gatsby-plugin-prefetch-google-fonts: ^1.4.3 => 1.4.3
gatsby-plugin-purgecss: ^4.0.0 => 4.0.0
gatsby-plugin-react-helmet: ^3.1.3 => 3.1.3
gatsby-plugin-react-svg: ^2.1.2 => 2.1.2
gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0
gatsby-plugin-sass: ^2.1.8 => 2.1.8
gatsby-plugin-segment-js: ^3.0.1 => 3.0.1
gatsby-plugin-sharp: ^2.2.12 => 2.2.12
gatsby-plugin-sitemap: ^2.2.6 => 2.2.6
gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5
gatsby-source-filesystem: ^2.1.9 => 2.1.9
gatsby-transformer-sharp: ^2.2.6 => 2.2.6
As @rbrcsk stated, disabling Windows Defender firewall doesn't change the result. Windows Defender is the only firewall I have running. It also seems unlikely that disabling "Real-time protection" in Windows Security would change the result because Windows auto-enables this on all Win10 machines by default.
Additionally, I went to Event Viewer. In Windows Logs > System, I checked for logs that might be consistent with the Gatsby error but do not find logs that match the latest times I failed to run gatsby develop successfully.
I am only able to reproduce this issue using gatsby develop.
I can't seem to reproduce it. It's a bit weird that it only happens sometimes. Could this be an issue with VPN? Or a firewall at work that you're not aware of?
Does rebooting fix the issue? I think it's not something we will be able to resolve.
For me, this happens consistently and I have never been able to get gatsby develop to work. I tried both a fresh install of Gatsby and an existing project I cloned from a repo, same result with both.
As an additional test, I tried a fresh install of Create React App and it works. Maybe adding GraphQL into that repo clone could reproduce what I'm seeing? I can't tell if this is a GraphQL issue or not.
I've tried this with and without a VPN, same result.
I reboot this a few times, same result after each reboot.
I'm not sure what other kind of firewall could be on since this is closer to a fresh install of Windows 10 with only custom, hand-picked software that I've installed myself.
Just to make absolutely sure there's not any VPN or firewall issue, I went through a bit more testing and verified everything.
What I did find was that Wireguard had a very specific Peer configuration for "AllowedIPs", defaulting to 0.0.0.0/0, ::/0. I updated this to be less specific like 0.0.0.0/1, 128.0.0.0/1, ::/1, 8000::/1.
With that update, I'm not getting the same error I was before but I still can't get Gatsby to work right. However, I think the change above fixed the specific error I was having so I'll close this issue out with this as the solution.
if we can assist with anything else please let us know, feel free to open another issue or ask questions on our discord channel.
This is a bit weird, because I don't have a VPN, or any other special networking software installed, and I still have this issue. I'll put together a minimal reproduction.
@rbrcsk maybe try running gatsby on a different port if it happens. WSL is a tricky beast.
My case is the same as @rbrcsk commented. It runs flawlessly but hang up randomly after some time running... (also using a different port)
I was using yarn start to run my gatsby app, and then I hit this problem out of nowhere for a while. I then used gatsby develop to start the app, and now the issue has disappeared.
I have no idea if it'll help but maybe it's a bit more of a clue. Although WSL has been a bit weird to me so it could be an issue with one of its dependencies?
I have the same issue, I am on ArchLinux
Dev server crashes with

while opening the browser
It turns out that it was because I ran that over proxychains, uncomment this line in /etc/proxychains.conf resolves the issue for me. Looks like the server retrieves localhost:8000 itself and fails on failure.
## RFC5735 Loopback address range
## if you enable this, you have to make sure remote_dns_subnet is not 127
## you'll need to enable it if you want to use an application that
## connects to localhost.
localnet 127.0.0.0/255.0.0.0
This issue has been bugging me. I'm also on WSL and when it happens some of my graphql queries stop working too.
We worked around this issue by switching ports! Used gatsby develop -p 8002
Most helpful comment
We worked around this issue by switching ports! Used
gatsby develop -p 8002