2

Solution may be pretty easy but I am a newbie so forgive me. Even I could launch the Node.js REPL and play around (create objects ,make calculations),the simple command below:

$ node --version

doesn't work.It says:

"Syntax Error: Unexpected Identifier" .

I am trying to write this to Node.js command prompt.I am using Windows 10.

Artem Kulikov
  • 2,250
  • 19
  • 32
Cansu Kipge
  • 23
  • 1
  • 5
  • 2
    http://stackoverflow.com/questions/14888471/node-js-version-on-the-command-line-not-the-repl – bro Aug 11 '15 at 10:46
  • When you say *"I am trying to write this to Node.js command prompt"* are you running the command **within** the `node` REPL? – jabclab Aug 11 '15 at 11:18

2 Answers2

3

You should run node --version from outside of the node REPL. If you want to get the version from within the REPL you can use:

$ node
> process.versions.node
'0.12.2'
jabclab
  • 14,786
  • 5
  • 54
  • 51
0

Try npm version instead:

zag2art@home:~/$ npm version

{ npm: '2.10.1',
  http_parser: '2.3',
  modules: '14',
  node: '0.12.4',
  openssl: '1.0.1m',
  uv: '1.5.0',
  v8: '3.28.71.19',
  zlib: '1.2.8' }

Enter it in the console, bash for example...

zag2art
  • 4,869
  • 1
  • 29
  • 39
  • The versions of npm and the version of node are not synchronized. You can update one without updating the other, depending upon your process. – Michael Paulukonis Sep 01 '16 at 13:39