question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSON file "Failed to compile"

See original GitHub issue
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue: I have some JSON files used for i18n in my app (using ng2-translate). In development using electron-forge start everything works great. After I run electron-forge make, the app throws an (impossible to diagnose) error Unexpected token F in JSON at position 0. Looking at DevTools’ Network tab, I see that the en.json file is found, but the response is the following error:

Failed to compile /Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/src/www/assets/i18n/en.json: Cannot read property 'get' of null
TypeError: Cannot read property 'get' of null
    at /Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/node_modules/electron-compile/lib/compiler-host.js:302:34
    at next (<anonymous>)
    at step (/Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/node_modules/electron-compile/lib/compiler-host.js:47:191)
    at /Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/node_modules/electron-compile/lib/compiler-host.js:47:361

Note of interest for future readers: The “F” in Unexpected token F in JSON at position 0 is the “F” in Failed to compile.

Obviously, something has gone wrong in the compile portion of the make process, but I am uncertain what it could be or how to avoid it. Surely other people have used JSON files have been used with Electron. 😉

Any guidance would be helpful.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Tmktahucommented, Mar 23, 2018

I was attempting to load the CSV through D3, but it didn’t seem to matter what I used. If the file was part of the package then the compiler would mess with it.

I was able to get around the issue by renaming the file from a .csv to a .txt. The compiler ignores it now and eventually I plan on taking input from a database rather than a file anyway.

1reaction
Lypziscommented, Mar 22, 2018

https://github.com/Lypzis/phaserAdvanced/blob/master/src/scripts/Preloader.js running on start works fine, the problem appears after package. line 18 is where it calls a .csv.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON file "Failed to compile" · Issue #152 · electron/forge
Looking at DevTools' Network tab, I see that the en.json file is found, but the response is the following error: Failed to compile...
Read more >
webpack 4 unable to compile json file - Stack Overflow
I'm using React Boilerplate 3.7.0 and webpack 4.23.1. In my project I have a json file to load and the webpack complains: ERROR...
Read more >
angular asp net6 read appsettings.json file Failed to compile
https://www.npmjs.com/package/read-appsettings-json. I did everything that is written here on this link, but it does not work.
Read more >
Compile errors with .json files? - Ask - GameDev.tv Community
Is this happening to anyone else? When I try to compile, it returns the error: ERROR: Unhandled exception: Dependency file ...
Read more >
The "build-wrapper-dump.json" file was found empty ...
Hello, I try to analyse a project and I applied the following steps, eventually I have '“build-wrapper-dump. json” file was found empty' error....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found