MEHMET BALIOGLU

SyntaxError: Unexpected token ‘<' error in Visual Studio Code

Visual Studio Code Error

One of the common errors encountered in Visual Studio Code is the SyntaxError: Unexpected token ‘<‘ . Like many errors in programming, this error code is unintuitive. One cannot simply grasp the reason, let alone its solution. I think these type of errors is one the the fundamental type of inefficiencies in programming because people loose their valuable time while trying to understand the source of the problem. Anyway, this is the error:

SyntaxError: Unexpected token ‘<‘

I’ve encountered this error while trying to run the live server mode in Visual Studio Code.

This error stems from a misconfigured script path. In my case it was this line of code:

reference to a non-existing script file

Just rectify the path (or comment it out if you don’t have a script file) and the error is gone!