13

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.

1 Answer 1

27

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

console.log('Node version is: ' + process.version); 
Sign up to request clarification or add additional context in comments.

2 Comments

While I wait the requisite 8 or so minutes to accept this answer, I'll kill time by saying thanks and commit github.com/rocky/trepanjs/commit/… acks your help.
And I see I can use process.versions which also gives the v8 version. stackoverflow.com/questions/11707698/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.