I need to programmatically access the current node version running in a library I am writing. Can\'t seem to find this in the docs.
Try to look at process.version property.
process.version.match(/^v(\d+\.\d+)/)[1]
if process.version
is 'v0.11.5', then get 0.11
.
If you access node js running environments, there are 2 main entries: (one simeple, one detail)
process.version
will give you:'v10.16.0'
process.versions
will give you:{ 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' }