11

In a debugger for nodejs, there is a command to show the V8 version and the debugger package version. How can I get the nodejs version?

I imagine I can basically run a command node --version or nodejs --version, but I'm hoping there a is way to do with without running an external shell command – which is not only slower but, depending on paths, might give a different answer.

rocky
  • 7,226
  • 3
  • 33
  • 74

1 Answers1

25

Use process.version to get the version of Node that is running:

console.log('Node version is: ' + process.version);
Trott
  • 66,479
  • 23
  • 173
  • 212
  • While I wait the requisite 8 or so minutes to accept this answer, I'll kill time by saying thanks and commit https://github.com/rocky/trepanjs/commit/81a68a6c8fb0507e041effadf8f06937728ff32e acks your help. – rocky Apr 23 '15 at 00:54
  • And I see I can use `process.versions` which also gives the v8 version. http://stackoverflow.com/questions/11707698/how-to-know-which-javascript-version-in-my-nodejs/11707742#11707742 – rocky Apr 23 '15 at 01:04