process.versions
process.versions
属性返回对象,其中列出了 Node.js 的版本字符串及其依赖项。
process.versions.modules
表示当前的 ABI 版本,每当 C++ API 更改时都会增加。
Node.js 将拒绝加载针对不同模块 ABI 版本编译的模块。
console.log(process.versions);
将生成类似于以下内容的对象:
{ node: '11.13.0',
v8: '7.0.276.38-node.18',
uv: '1.27.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '67',
nghttp2: '1.34.0',
napi: '4',
llhttp: '1.1.1',
openssl: '1.1.1b',
cldr: '34.0',
icu: '63.1',
tz: '2018e',
unicode: '11.0' }
The process.versions
property returns an object listing the version strings of
Node.js and its dependencies. process.versions.modules
indicates the current
ABI version, which is increased whenever a C++ API changes. Node.js will refuse
to load modules that were compiled against a different module ABI version.
console.log(process.versions);
Will generate an object similar to:
{ node: '11.13.0',
v8: '7.0.276.38-node.18',
uv: '1.27.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '67',
nghttp2: '1.34.0',
napi: '4',
llhttp: '1.1.1',
openssl: '1.1.1b',
cldr: '34.0',
icu: '63.1',
tz: '2018e',
unicode: '11.0' }