gatsby: gatsby build error #11328 A page component must export a React component for it to be valid. Please make sure this file exports a React component: /Users/tiagosanchez/Documents/Projects/personalBlog/node_modules/gatsby-plugin-offline/app-shell.js
Description
I run gatsby build on CLI for my blog (I am using gatsby-theme-blog and you can find it in the following link, the repo for my blog.
This was done following your tutorial link to prepare your site to be publish. The fist time I did it, it did run well, however after running the audit with Lighthouse and going through adding manifest and all the other good stuff, it is not working.
I have the following error on my console
ERROR #11328
A page component must export a React component for it to be valid. Please make sure this file exports a React component:
/Users/tiagosanchez/Documents/Projects/personalBlog/node_modules/gatsby-plugin-offline/app-shell.js
If I go a couple of commits back (cf09d3e986c4b01efc0941d5192c7fd47d4be24e) to this one I am able to run gatsby build.
After further testing I notice that gatsby-plugin-offlineis the cause of the issue, not sure why that is the case.
Could you please point me in the right direction?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 13
- Comments: 24 (12 by maintainers)
It seems that this error only started in the latest release, so you can install an older release to get your build working until this stops being an issue.
Quick Fix Instructions
package.json, change the line"gatsby-plugin-offline": "^2.2.10"to"gatsby-plugin-offline": "2.2.9"npm installto update the packagegatsby buildRunning
npm upgradefixed it for me, too. Thanks @davidbailey00!I had this issue and it was due to use of a file,
pages/components.js, that didn’t export a default. I modified it to export a dummy component and it resolved the issue.Really weird, I’ve checked this out and only experiencing that issue when I attempt to deploy to Now, but not locally. Might be something to do with Node.js versions
Hi @davidbailey00, thank you for jumping in. So the
gatsby-inforeturns the followingAfter upgrading
npmI am go to go, and it did work. So, to your point it is a version mismatchThank you!
I think if you run
npm upgrade --latestit should fix this error - seems to be caused by a version mismatch of some kind. Could you try this and confirm? If not, would love to see yourgatsby infooutput!