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.

Uncaught SyntaxError: Unexpected token '<'

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Syndicistcommented, Mar 2, 2020

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. image

And to be clear about my filesystem organization: image image react-docker/frontend is the react project directory.

edit: aaaaaannnnnd found my issue. Build.json is actually MyGame.json. I’m an idiot.

2reactions
RazrSlyrcommented, Jan 6, 2022

Okay I was able to fix the issue. I had to add “workshop/” to the beginning of all my paths for the unityContext. image

Read more comments on GitHub >

github_iconTop 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 >

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