Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby Build, Serve can't find Resource '/' #11461

Closed
thinkocapo opened this issue Jan 31, 2019 · 5 comments
Closed

Gatsby Build, Serve can't find Resource '/' #11461

thinkocapo opened this issue Jan 31, 2019 · 5 comments
Labels
status: awaiting author response Additional information has been requested from the author type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@thinkocapo
Copy link

Steps to reproduce

gatsby --version
2.4.8
gatsby new my-site
// success, no errors

cd my-site
gatsby build
// success, no errors

gatsby serve
// info gatsby serve running at: http://localhost:9000/

Go to http://localhost:9000/ and the page is blank (white), check chrome console...

Expected result

The landing page should load. This works if I run gatsby develop and go to localhost:8000. No errors in chrome console.

Actual result

When you run gatsby serve and go to localhost:9000, page loads blank (white), so check chrome console:

Failed to load resource: the server responded with a status of 404 (Not Found)
app-05873d9c14927591ecdc.js:1 Error: Missing resources for /
    at t.n.render (app-05873d9c14927591ecdc.js:1)
    at ci (app-05873d9c14927591ecdc.js:1)
    at ui (app-05873d9c14927591ecdc.js:1)
    at pi (app-05873d9c14927591ecdc.js:1)
    at Qi (app-05873d9c14927591ecdc.js:1)
    at Yi (app-05873d9c14927591ecdc.js:1)
    at Ma (app-05873d9c14927591ecdc.js:1)
    at Na (app-05873d9c14927591ecdc.js:1)
    at Pa (app-05873d9c14927591ecdc.js:1)
    at ta (app-05873d9c14927591ecdc.js:1)

Environment

gatsby info --clipboard

  System:
    OS: Linux 4.15 Pop!_OS 18.04 LTS
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 4.4.19 - /bin/bash
  Binaries:
    Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
    npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
  Languages:
    Python: 2.7.15 - /usr/bin/python
  Browsers:
    Chrome: 70.0.3538.102
    Firefox: 63.0
  npmPackages:
    gatsby: ^2.0.107 => 2.0.107 
    gatsby-image: ^2.0.29 => 2.0.29 
    gatsby-plugin-manifest: ^2.0.16 => 2.0.16 
    gatsby-plugin-offline: ^2.0.22 => 2.0.22 
    gatsby-plugin-react-helmet: ^3.0.5 => 3.0.5 
    gatsby-plugin-sharp: ^2.0.19 => 2.0.19 
    gatsby-source-filesystem: ^2.0.19 => 2.0.19 
    gatsby-transformer-sharp: ^2.1.13 => 2.1.13 
  npmGlobalPackages:
    gatsby-cli: 2.4.8

Other

  • When I do ls public it shows a bunch of file and directories, including an index.html.
  • Is there something simple I'm missing here?
  • Some arguments to pass to the build or serve commands?
  • I was following this: https://www.gatsbyjs.org/docs/gatsby-cli/
  • does this work for you guys? takes a minute if you could test it, just a simple build and serve, I did not modify any code.
  • certain branch to try? Previous version to could try, maybe will work?
  • I'm on Ubuntu 18.04 and have run prod builds of React and Angular apps locally before. First time using GatsbyJS.
@thinkocapo
Copy link
Author

Its not finding some of the generated files in /public? Mismatch between what's being called and what exists?
screenshot from 2019-01-31 18-35-01

@marcysutton
Copy link
Contributor

I ran into something similar when trying to build, and it was because an error was thrown in the build and there weren't generated HTML files in the public folder. You're saying public/index.html is there, but it's not loading for some reason?

@sidharthachatterjee
Copy link
Contributor

Can't reproduce this locally

It seems like a lot of responses including the webpack runtime is coming from a service worker. Perhaps, a previously run site on the same port registered a service worker?

Try clearing your application and service worker cache in Chrome and see if that fixes this?

@sidharthachatterjee sidharthachatterjee added type: question or discussion Issue discussing or asking a question about Gatsby status: awaiting author response Additional information has been requested from the author labels Feb 1, 2019
@thinkocapo
Copy link
Author

@sidharthachatterjee thank you that worked. I went to Dev Tools > Application Tab > Service Worker > click 'Unregister Service Worker' and it now works.

Before that I also tried running it in a Chrome Incognito Window and Mozilla - both worked. Should have tried that sooner. But didn't know Service Worker could cause interference here.

@sidharthachatterjee
Copy link
Contributor

Glad that worked, @thinkocapo

Thank you for using Gatsby!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting author response Additional information has been requested from the author type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants