Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the nodejs version inside a nodejs program?

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.

like image 643
rocky Avatar asked Apr 23 '15 00:04

rocky


1 Answers

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

console.log('Node version is: ' + process.version);
like image 157
Trott Avatar answered Sep 28 '22 12:09

Trott