Stack Overflow Asked by Ericgit on December 23, 2021
I’ve gatsby project which works fine and also have 404 page, but either I get the error during gatsby build
or open the browser after successfully completed the build process:
Building static HTML for pageserror: Error: ENOENT: no such file or directory
if the error I didn’t get during the gatsby build
time then I have to get on the browser when run gatsby serve
and open browser:
Error: ENOENT: no such file or directory, stat '/project/public/404.html'
If the above answers don't work for you (didn't for me), Gatsby keeps a copy of a config.json here ~/.config/gatsby/config.json
.
Deleting the file made it work for me.
Relevant Github issue from the Gatsby repo
Answered by Sohan on December 23, 2021
// clean gatsby cache
gatsby clean
// delete node modules, cache and public folder.
rm -rf node_module .cache public
// reinstall node modules
npm install
// run gatsby in develop mode
gatsby develop
// build the gatsby project
npm run build
// serve the building project.
gatsby serve
Answered by Dhanuka Perera on December 23, 2021
add 404.js
or 404.tsx
file inside pages
folder if you don't
build
.cache
, and node_modules
.yarn add pkg.json
npm install *
gatsby develop
before gatsby build
probably you're using React.lazy
suspense
in your component which doesn't support server-side render, you need to remove it by any possible way.
then try this should work!
Answered by Ericgit on December 23, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP