Skip to content Skip to sidebar Skip to footer

Uncaught Syntaxerror: Unexpected Token < Line One Js

I have seen many questions similar to this one on here but none of them seem to fix the problem I am having. I keep getting the following error- Uncaught SyntaxError: Unexpected to

Solution 1:

Does your webserver happen to have a rule where if the requested resources is not found it will default to serving the index.html file? This is a popular configuration for Single Page Applications.

If that is the case, if the server can not find the js file requested it will serve the contents of the html file, which the browser will try parse as JavaScript. Since the first character on the first line of the html file is < you'll get a syntax error since that is not valid JavaScript.

Post a Comment for "Uncaught Syntaxerror: Unexpected Token < Line One Js"