Related Articles

Related Articles

Node.js | process.version Property
  • Last Updated : 02 Mar, 2020

The process.version property is an inbuilt application programming interface of the Process module which is used to check the node.js version.

Syntax:

process.version

Return: It returns a string signifying the version of the Node.js.

Below examples illustrate the use of process.version property in Node.js:

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

// Allocating process module
const process = require('process');
  
// Printing process.version
console.log("node.js version " + process.version);

chevron_right


Output:

node.js version v10.16.0

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Allocating process module
const process = require('process');
  
// Printing process.version
const ver = process.version;
console.log("node.js version " + ver);
  
// Printing version name
var name = "";
  
if(ver.startsWith('v10.')) {
        name = 'Dubnium';
}else if(ver.startsWith('v8.')) {
    name = 'Caron';
}else if(ver.startsWith('v6.')) {
    name = 'Boron';
}else if(ver.startsWith('v4.')) {
    name = 'Argon';
}else {
    name = 'unknown';
}
console.log("Node.js version name: " + name);

chevron_right


Output:

node.js version v10.16.0
Node.js version name: Dubnium

Reference: https://nodejs.org/api/process.html#process_process_version

My Personal Notes arrow_drop_up
Recommended Articles
Page :