To check the version of Node.js that you have installed on your computer, you can use the node -v
or node --version
command. This will print the version number to the terminal or command prompt, like this:
1 2 |
$ node -v v14.15.1 |
Alternatively, you can use the process.versions
property of the process
global object in Node.js to print the version information. Here is an example:
1 |
console.log(process.versions); |
This will print something like the following to the output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{ http_parser: '2.9.3', node: '14.15.1', v8: '7.9.317.25-node.52', uv: '1.40.0', zlib: '1.2.11', ares: '1.16.1', modules: '83', nghttp2: '1.41.0', napi: '6', openssl: '1.1.1k', icu: '67.1', unicode: '13.0', cldr: '37.0', tz: '2022a' } |
The process.versions
property is an object that contains detailed information about the version of Node.js that is installed, including the version of the node
and v8
modules, as well as the versions of other libraries and modules that are bundled with Node.js. You can access the properties of this object to get more specific information about the installed version of Node.js.
I hope this helps! Let me know if you have any other questions.