1

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?

1
  • Check if the file doesn't have any special characters. Commented Nov 15, 2016 at 10:23

2 Answers 2

1

It seems to be some problem with your node installation.

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

2 Comments

You would have posted this as a comment
@DushyantJoshi i know i could have posted as a comment but unfortunately StackOverflow is not allowing me because i dont have reputation of 50
0

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 .

1 Comment

How does lodash come into the picture?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.