gatsby: FetchError: request to http://localhost:8000/___graphql failed, reason: socket hang up
This might be related to https://github.com/gatsbyjs/gatsby/issues/14990 and https://github.com/gatsbyjs/gatsby/issues/15441.
Description
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.
Steps to reproduce
gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-worldcd hello-worldgatsby develop
Expected result
Web server should run to allow localhost:8000 to run in browser
Actual result
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
Environment
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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (6 by maintainers)
We worked around this issue by switching ports! Used
gatsby develop -p 8002I 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.