1

I want to use the node.js on the windows. so I install node but I can't execute a .js file. That is my source code. And I atteched the error screen.

helloworld.js

console.log("Hello, World!")

enter image description here

1
  • 1
    don't name your file node.js i think it confuses it. Commented Jun 30, 2016 at 23:59

1 Answer 1

3

This error is happening because your script is not executed with nodejs but with Microsoft jscript.

The command you wrote "node node.js" is executing the file ode.js instead of the nodejs in your system in the same way you can execute cmd by typing cmd instead of cmd.exe.

To fix that you need to do one of those :

  • rename the file to something other than node
  • move the file named node in a subfolder (i.e. src/node.js)
  • associate .js file with nodejs instead of microsoft jscript
Sign up to request clarification or add additional context in comments.

Comments

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.