"Uncaught SyntaxError: Unexpected token <" when refreshing page
See original GitHub issueWhenever I do a normal refresh, i get these error messages:
manifest.48cbf0211cc2b417df60.js:1 Uncaught SyntaxError: Unexpected token <
vendor.e73f0cf5e42d1a1bdeee.js:1 Uncaught SyntaxError: Unexpected token <
app.d644989e00d1de883ada.js:1 Uncaught SyntaxError: Unexpected token <
When looking in the Network tab, it´s like the entire HTML document (index.html) is being returned instead of the js file. https://imgur.com/a/6AR5P
I’m assuming this has to do with the src to the js-files are returning 404. Question is why though?
If I hit hard refresh (Ctrl + F5), the site loads fine.
Does anyone have any clues?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:18
- Comments:30
Top Results From Across the Web
Got this error after refreshing page in ReactJS app: Uncaught ...
I keep getting this error Uncaught SyntaxError: Unexpected token '<' after I refresh the page. The error comes from a top level component ......
Read more >Uncaught SyntaxError: Unexpected token; Menu doesn't ...
Uncaught SyntaxError : Unexpected token; Menu doesn't respond to click. This code below was accepted by auto check even though the syntax error...
Read more >Uncaught SyntaxError: Unexpected token "<" : r/reactjs - Reddit
Hi guys, it's a weird issue I've got after I deployed my PWA application to prod (EKS). Some users and one of my...
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 >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 Free
Top 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
See this guys https://github.com/webpack/webpack/issues/2882#issuecomment-280906981
You just need to add
<base href="/" />
into the<head>
of yourindex.html
. This resolved my problem. It may help you too.Thanks
I get the same issue but not on every refresh, only sometimes after I deploy the app.
From what I understand, the first time I open the app it tries to load a JS files from the previous version (e.g.
chunk-9a00505e.02e15df7.js
), which doesn’t exist anymore, and which serves a 404 HTML page (that obviously starts with<
).A refresh fixes this, except on progressive web apps on Safari because there is no reload button nor a “swipe down to refresh” action. It’s very frustrating for users, as well as for me who asks them to restart their phones.
Has anyone been in the same situation?