Skip to content
Advertisement

Node js Uncaught SyntaxError: Unexpected identifier

When I call node filename.js then it return an error.(Uncaught SyntaxError: Unexpected identifier).

enter image description here

How can I fix it?

Thanks

Advertisement

Answer

You are inside the node command mode after you type node, you should quit with Ctrl + C and you only need to run your js file in the terminal with node jsfile.js instead of running in the node command mode.

Advertisement