process.version
process.version
属性包含 Node.js 版本字符串。
console.log(`Version: ${process.version}`);
// Version: v14.8.0
要获取不带 v 的版本字符串,则使用 process.versions.node
。
The process.version
property contains the Node.js version string.
console.log(`Version: ${process.version}`);
// Version: v14.8.0
To get the version string without the prepended v, use
process.versions.node
.