1

I've installed Node.js version 10.16.0 LTS. I run "node -v" command in cmd to check if it's installed correctly or not.

created a file hello.js run cmd in the same directory

the error msg says: D:\nodeJS>node

node hello.js Thrown: node hello.js ^^^^^ SyntaxError: Unexpected identifier

the only line of code I wrote in .js file is : console.log("hello");

for(var i = 0; i < 10; i++){
    console.log("hello");
}
0

1 Answer 1

1

You ran it in the node REPL. Press control + c twice to get out of the Node REPL. Then you run the command node hello.js

Sign up to request clarification or add additional context in comments.

1 Comment

Great. Please mark my answer as correct. And you are welcome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.