Errors / JavaScript errors
Uncaught SyntaxError: Unexpected token '<'
The browser asked for a script and got a web page instead, usually an error page or the home page.
That script does nothing; if it is the app's main bundle, the page stays blank.
Why it happens
- The script's URL is wrong or the file is gone, and the server answers with an HTML page (a 404 page, or a single-page app's
index.htmlfor every unknown path) with status 200. - After a deploy, old HTML still cached somewhere points at script files the new build removed.
- A JSON request answered with an HTML error page:
JSON.parsemeets<!DOCTYPE.
How to fix it
- Open the script's URL directly; if you see HTML, that is the problem. Fix the path, or make missing assets answer 404 instead of falling through to
index.html. - Keep the previous build's files for a while after a deploy, or make HTML uncacheable so it never points at deleted files.
- For JSON, check
response.okand the content type before parsing.
Whose problem it is
Usually the site's own code or settings.
Does your site have it?
Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.
Often seen with
- Refused to execute script: MIME typeThe browser asked for a script and got something else, so it would not run it.
- Failed to fetch dynamically imported moduleThe site was updated while the visitor had it open, and the part they clicked on no longer exists.
- Unexpected end of JSON inputThe page expected data from the server and got an empty answer.