Skip to content

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.html for 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.parse meets <!DOCTYPE.

How to fix it

  1. 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.
  2. Keep the previous build's files for a while after a deploy, or make HTML uncacheable so it never points at deleted files.
  3. For JSON, check response.ok and 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.

Check only sites you run or have permission to check.

Often seen with