How to run Gatsby website in a way that reproduces 404 error from live site?

331 views Asked by At

I have a Gatsby site that throws a 404 error in Chrome devtools when run live. When I run it locally with npm run develop, I don't see the error. Is there a way to run the site locally in a way that mimics the live site so that I'm more likely to see the 404 error?

1

There are 1 answers

0
Ferran Buireu On

Just run:

gatsby build

And

gatsby serve

Summarizing, gatsby build will compile your application and make it ready for deployment while gatsby serve will serve the production build of your site for testing, by default at port 9000.

More details about gatsby-cli commands at: https://www.gatsbyjs.com/docs/reference/gatsby-cli/