Build is failing on static HTML for pages. I've backed out all changes from the current commit, and am still seeing the same build error. Dev works fine, and pages are loading as expected.
Gatsby version: 1.9.73
Node.js version: 3.10.3
Operating System: Windows 10
gatsby-config.js:
package.json:
gatsby-node.js:
gatsby-browser.js:
gatsby-ssr.js:
Build error:
`success Building CSS — 8.583 s
success Building production JavaScript bundles — 21.215 s
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
Error: Module build failed: SyntaxError: Unexpected end of JSON input
JSON.parse
index.js:4 Object.module.exports
[open.fda.gov]/[json-loader]/index.js:4:49
@ ./.cache/sync-requires.js 64:23-109 66:40-126 66:284-370 66:536-622 66:770-856 66:1020-1106 66:1282-1368 66:1538-1624 66:1796-1882 66:2048-2134 66:2310-2396 66:2576-2662 66:2838-2924 66:3116-3202 66:3390-3476 66:3652-3738 66:3898-3984 66:4144-4230 66:4390-4476 66: 4636-4722 66:4878-4964 66:5152-5238 66:5394-5480 66:5674-5760 66:5916-6002 66:6300-6386 66:6664-6750 66:6978-7064 66:7328-7414 66:7646-7732 66:8016-8102 66:8364-8450 66:8690-8776 66:9012-9098 66:9316-9402 66:9642-9728 66:9950-10036 66:10236-10322 66:10510-10596 66:1 0784-10870 66:11080-11166 66:11358-11444 66:11648-11734 66:11926-12012 66:12200-12286 66:12480-12566 66:12786-12872 66:13060-13146 66:13346-13432 66:13620-13706
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gatsby build --verbose``
What should happen?
1. This is the branch on github
2. Running dev:css and dev:site works fine and the site looks how it should.
3. Running build generates the error listed above. The issue started with commit c687dcbbd6e6e7b4b48e7fa7d55b431c39ba17e1, but even after backing out all of those changes, the build error persists.
Any help would be appreciated!
wow. the FDA is using Gatsby?! That's so rad.
Apologies for stating the obvious but I think there's an issue with one of your JSON files. This same issue plagued me -- that is, gatsby develop works but gatsby build didn't -- and I got the same error. I narrowed it down by commenting out all the references to JSON files, running gatsby build, then uncommenting each reference until the error popped back up. I was able to narrow it to one file. Scanning the file, I found a missing ,. It happened a week later and the issue was incorrect lat/long values.
I'm super curious of your results. I'm happy to dig further but try a few of those tricks and let us know what you find. Good luck!
It's almost certainly the same issue as https://github.com/gatsbyjs/gatsby/issues/3094
Working on fixing this now 👍
Thanks, @benjaminhoffman. I ended up finding that this seems to be an issue with the latest version of gatsby. I found issue #3094 and reverted gatsby back to 1.9.123 on a hunch. Everything builds fine after this - it looks like there's some sort of issue with long JSONs in the latest versions of gatsby.
I manually scanned and machine validated all of our JSONs to ensure there weren't any errors in them, and found that the error wasn't occurring consistently or related to any specific one of them. This is definitely an odd one to troubleshoot.
In any event, reverting fixed the issue for now. I'll follow #3094 for updates. Sorry for the duplicate issue!
@beardedfinch try the latest gatsby release when you have a chance. #3218 should have fixed the problem you were running into. Would love to hear back if it's working now for ya.
Most helpful comment
Thanks, @benjaminhoffman. I ended up finding that this seems to be an issue with the latest version of gatsby. I found issue #3094 and reverted gatsby back to 1.9.123 on a hunch. Everything builds fine after this - it looks like there's some sort of issue with long JSONs in the latest versions of gatsby.
I manually scanned and machine validated all of our JSONs to ensure there weren't any errors in them, and found that the error wasn't occurring consistently or related to any specific one of them. This is definitely an odd one to troubleshoot.
In any event, reverting fixed the issue for now. I'll follow #3094 for updates. Sorry for the duplicate issue!