Node.js process.versions Property
Last Updated :
11 Apr, 2022
The process.versions property is an inbuilt application programming interface of the process module which is used to get the versions of node.js modules and it’s dependencies. Syntax:
process.versions
Return Value: This property returns an object containing the versions of the node.js module and it’s dependencies. Below examples illustrate the use of process.versions property in Node.js: Example 1:
javascript
const process = require( 'process' );
console.log(process.versions);
|
Output:
{ http_parser: '2.8.0',
node: '10.16.0',
v8: '6.8.275.32-node.52',
uv: '1.28.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '64',
nghttp2: '1.34.0',
napi: '4',
openssl: '1.1.1b',
icu: '64.2',
unicode: '12.1',
cldr: '35.1',
tz: '2019a' }
Example 2:
javascript
const process = require( 'process' );
var no_versions = 0;
var versions = process.versions;
for ( var key in versions) {
console.log(key + ":\t\t\t" + versions[key]);
no_versions++;
}
console.log("Total no of values available = " + no_versions);
|
Output:
http_parser: 2.8.0
node: 10.16.0
v8: 6.8.275.32-node.52
uv: 1.28.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 4
openssl: 1.1.1b
icu: 64.2
unicode: 12.1
cldr: 35.1
tz: 2019a
Total no of values available = 15
Example 3:
javascript
const process = require( 'process' );
var versions = process.versions;
console.log("node version: " + versions.node);
console.log("openssl version: " + versions.openssl);
console.log("module versions: " + versions.modules);
|
Output:
node version: 10.16.0
openssl version: 1.1.1b
module versions: 64
Note: The above program will compile and run by using the node filename.js command. Reference: https://nodejs.org/api/process.html#process_process_versions
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...