recently i was trying to open my old projects which were error free a while ago and now I am finding this error Syntax error:Unexpected token'<' in all of my html files at the very first line as I am beginner I am seeking out for help all of my files with error contain html and css only [![enter image description here][1]][1] The above image represents the error
I tried by reinstalling nodemon modules.I even checked every line of code I even tried removing ""line but then the error came on the second line ""
I am running a local server,its not a template.I dont know why is it being evaluated
^
SyntaxError: Unexpected token '<' at internalCompileFunction (node:internal/vm:77:18) at wrapSafe (node:internal/modules/cjs/loader:1288:20) at Module._compile (node:internal/modules/cjs/loader:1340:27) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49
Node.js v21.4.0 [nodemon] app crashed - waiting for file changes before starting...
Nodemon is to serve the javascript files. Instead you can use http-server to run your html files:
Here is how you can install it:
npm i -g http-serverAnd run this command in the your directory:
http-serverYou don't even need to specify index.html, as it looks for the file by same name.