Reputation: 151
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!")
Upvotes: 1
Views: 1501
Reputation: 740
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 :
node
node
in a subfolder (i.e. src/node.js
).js
file with nodejs
instead of microsoft jscript
Upvotes: 3