How To Check Node Version [Step-By-Step Guide: Install Node.js and Check Node Version]
Node.js is an open-source, cross-platform JavaScript runtime environment that allows developers to run JavaScript code server-side, beyond its traditional use in web browsers. Built on Chrome's V8 JavaScript engine, Node.js is instrumental in creating scalable, interactive web applications capable of efficiently managing concurrent connections in real time.
This guide will teach you how to check Node version after installing Node.js on your system. We will also cover the installation steps of Node.js on Linux and Windows operating systems. But let’s start with the basics.
What Are the Key Features of Node.js?
Node.js boasts a plethora of features that make it a top choice for web application development. Here's a breakdown of its key attributes.
Event-Driven and Asynchronous
- Node.js operates on an event-driven model with asynchronous I/O.
- It performs tasks concurrently, allowing the system to handle other operations simultaneously.
- This architecture is essential for building responsive and scalable applications.
JavaScript Language Support
- Node.js utilizes JavaScript for both frontend and backend development.
- Language continuity enables smooth transitions between different parts of an application.
NPM (Node Package Manager)
- Node.js includes NPM, a package manager providing a wide range of libraries and modules.
- Developers can seamlessly integrate third-party solutions, saving time and effort.
Scalability Focus
- Node.js is designed to manage a high volume of connections without overloading resources.
- Its non-blocking I/O and event-driven approach enhance scalability, suitable for varying workloads.
Speed Up Code Execution
- Node.js leverages the V8 JavaScript engine for quick code execution.
- This performance contributes to its suitability for real-time applications.
Cross-Platform Compatibility
- Node.js is compatible with diverse operating systems.
- Its versatility makes it applicable across different environments.
Server-Side Web Development
- Node.js is widely used for building server-side components like web servers and APIs.
- It's valuable for creating APIs that power frontend frameworks like React, Angular, and Vue.js.
Streaming Capability
- Node.js excels in managing data streams, making it ideal for tasks involving real-time multimedia streaming and file handling.
How To Check Node Version on Your System? (Ways To Check Node Version)
There are multiple ways to check the Node version running on your system. The following methods can help you find the Node version you are using on different operating systems:
- Check the Node.js version using the node version command node --version or the shorthand node -v.
- Check Node version at runtime using process.version property.
- Manage and check the Node version using NVM.
How To Check Node.js Version on Linux?
Node.js can be installed and run on multiple operating systems, such as Linux, Windows, and macOS. Over time, several Node.js releases have been made available for installation. The best version for you would depend on your specific application needs.
You can check the Node version installed on your system by running the following command:
$ node --version
It will display the Node version on your command-line window running on your system.
If you don’t have Node.js installed on your Linux system, don’t worry! In this section, we will guide you on how to check Node version with complete Node.js installation on Linux.
You can install Node.js on the Linux Ubuntu distribution using the following steps.
Step 1: Update Your Repositories
Before starting the Node.js installation on your system, ensure that all your Linux system repositories are up to date. Launch the terminal using ‘Ctrl+Alt+T’ or open it from the application menu.
Now, update apt repositories using the below command:
$ sudo apt update
Step 2: Install Node.js and NPM
Install Node.js on your Linux system by executing the below command:
$ sudo apt install node
Always install the NPM (Node Package Manager) with Node.js or node server. NPM allows you to install open-source libraries and Node.js packages on your system.
You can install NPM along with the Node.js using this command:
$ sudo apt install Node.js npm
To check the NPM version, you can use the below command:
$ npm –version
Step 3: Verify Node.js Installation
You can verify the Node.js installation on your system using the following command:
$ node –version
Alternatively, you can also check the node version using the node command:
$ node -v
Both commands will display the installed Node.js version on your terminal screen. Using the above method, you can also check the Node.js version on bluevps for Linux.
Uninstall Node.Js
To uninstall or remove the Node.js version, use the below-mentioned command:
$ sudo apt remove node.js
How To Check Node Version on Windows?
For Windows users, it's straightforward to install and check Node.js on the system. Before we proceed, ensure you have administrative privileges to run commands on the command prompt. If Node.js isn't yet installed on your Windows OS, follow these steps:
Step 1: Download the Node.js MSI Installer
Go to the official Node.js website and select the appropriate Node.js Windows Installer based on your system architecture:
- For a 64-bit system, choose the x64-bit installer.
- For a 32-bit system, choose the x32-bit installer.
In this guide, we'll be downloading the stable version, node-v18.14.0.
Step 2: Launch the Installer
After completing the download, navigate to the folder or directory where you store the Node.js installer. You will double-click on the installer to launch the installation wizard.
Step 3: Start the Setup Wizard
The Node.js setup wizard will launch on your system. Click ‘Next’ to proceed.
Step 4: Accept the License Agreement
Accept the terms of the End User License Agreement and click ‘Next.’
Step 5: Choose Installation Path
Select the desired folder for Node.js installation. If you prefer the default path, simply click 'Next.'
Step 6: Additional Tools
If you want to install tools necessary to compile native modules, mark the checkbox and click ‘Next.’
Step 7: Begin Installation
Now, your setup is ready for installation. Click ‘Install’ to start the Node.js installation on your Windows system.
Step 8: Complete the Installation
Once you complete the Node.js installation on your system, click ‘Finish’ to close the Node.js setup wizard.
With Node.js installed, you can now verify to get Node version. Open the command prompt and enter:
> node --version
Alternatively, use:
> node -v
Both commands will display the installed Node.js version on your Windows system.
How To Check Node Version Using Console.Log? (Process.Version Property)
Once you install Node.js on your system, you can check the current Node release using the process.version property. To check Node version using console.log, type the ‘node’ command on the command prompt and then execute the following statement:
> node
The above command will open the Node terminal on the command prompt. Now, check the currently installed Node.js version:
> console.log(process.version)
Alternatively, you can also directly get the node version at runtime using the built-in ‘process.version’ property:
> process.version
You can get the versions of Node modules, including all dependencies, using the ‘process.versions’ property. Run this command on the command prompt:
> process.versions
The above command will return an object that will contain information about versions of the Node.js module and Node dependencies.
How To Manage the Node.js Version Using NVM?
You can install Node.js on your Linux system using NVM (Node Version Manager). To do this, download the bash script file on your Linux system:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Source the downloaded bash script:
$ source ~/.bashrc
Now, list the available Node.js --versions using the nvm command:
$ nvm list-remote
Choose the latest or specific Node.js version and install it running the below command:
$ nvm install v20.5.1
Check Node.js version, which is currently installed on your Linux system.
Conclusion
Throughout this guide, we delved into methods to determine the Node.js version on both Linux and Windows platforms. We explored the direct approach using the node version command node --version or node -v, as well as retrieving the Node.js version at runtime with the integral process.version property.
Node.js stands out in the tech ecosystem, not merely for its versatility but also for its distinctive advantage of harnessing JavaScript on both the front end and back end. Its prowess is evident in its widespread adoption for creating web servers, real-time applications, APIs, streaming services, chat interfaces, and a plethora of other applications.
So, having a firm grasp of Node.js and its intricacies is pivotal for modern developers aiming to produce efficient and responsive web applications.