Uncaught SyntaxError: Unexpected token '<'
See original GitHub issueI’m not sure if this is something with React itself or the package. I get this in the browser console when trying to load my Unity game
JSON.parse: unexpected character at line 1 column 1 of the JSON data
I’ve tested the same build outside of React and it loads without an issue. Any help would be appreciated. My Unity version is 2018.3.1f1
- Apologies if this is obvious. I’ve only just started to use React in the last few days.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Uncaught SyntaxError: Unexpected token - javascript
An "unexpected token" is likely some illegal character code. Such a code is likely not to show up when you print to console....
Read more >SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >Uncaught SyntaxError: Unexpected token < - JavaScript - iDiallo
All it means is that the interpreter is expecting JavaScript or JSON and you are feeding it HTML/XML. If you don't think you...
Read more >SyntaxError: Unexpected token in JavaScript
The "Uncaught SyntaxError: Unexpected token" occurs for multiple reasons: · The error is also caused if you're making an HTTP request to a...
Read more >How to Fix Uncaught SyntaxError: Unexpected token '{'
The JavaScript exceptions " unexpected token " occur when a specific language construct was expected, but something else was provided.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue I made (referenced directly above) was marked as a duplicate of this one - though, my filesystem was exactly as described as the above, which is why I made a new issue about it. Digging a little deeper, it looks like it makes it this far, but the error is still persisting.
And to be clear about my filesystem organization: react-docker/frontend is the react project directory.
edit: aaaaaannnnnd found my issue. Build.json is actually MyGame.json. I’m an idiot.
Okay I was able to fix the issue. I had to add “workshop/” to the beginning of all my paths for the unityContext.