1
votes

I have followed many tutorials and many question on stackoverflow as well, but nothing is working from mine side.

I have make file in C: Directory name hello.js which contain
console.log("Hello world!");

but when i am trying to run in cmd

node Hello.js;

or

node C:\Hello.js

it throws something like that

 C:\Node\hello.js:1 (function (exports, require, module, __filename, __dirname) { ?
                                                               ^

 SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:139:18) at node.js:968:3

What i am missing, please explain?

2
Check if the file doesn't have any special characters.Dushyant Joshi

2 Answers

1
votes

It seems to be some problem with your node installation.

0
votes

npm update probably would have done it too. Looks like a bad version of node got published and you hit npm at just the wrong time .