The beauty of modern development is that you have powerful tools and frameworks that can significantly boost your productivity. One such tool is Node JS, a run-time environment that allows you to run JavaScript on your server. It’s highly efficient and powers some of the biggest websites globally, such as Netflix, LinkedIn, and Uber.
In this Answer, we will see the process of installing Node JS on your system.
Node JS is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside a web browser. It allows us to build scalable network applications and perform asynchronous programming.
You can install Node JS on three major platforms which are Windows, macOS, and Linux. We will discuss the installation process for each of these platforms.
Let’s first see how to install Node JS on windows.
Firstly, head to the official Node JS website. You will find the Windows Installer under ‘Downloads.’ For most users, the LTS (Long Term Support) version is recommended. Click on the Windows Installer (.msi).
After the installer is downloaded, run it. You will be guided through the setup process. Accept the license agreement, and keep the default settings unless you have specific requirements.
Once the installation process is complete, you can test it. Open your command prompt and type the following command:
node -v
This command will display the version of Node JS installed on your system, confirming a successful installation.
To install Node JS on macOS, follow the following steps.
As with Windows, visit the Node JS website and click on macOS Installer (.pkg) under ‘Downloads.’
After downloading, open the .pkg file and follow the instructions to install Node JS.
To confirm the successful installation, open the Terminal, and run:
node -v
If the Node JS version appears, your installation is successful.
The installation process on Linux can vary depending on the distribution. Here, we’ll use Ubuntu for our example.
Before installation, update your system with the following command:
sudo apt-get update
Next, install Node JS with the following command:
sudo apt-get install nodejs
Finally, verify the installation with:
node -v
After successful installation, you’re ready to write and run your first Node JS program. Create a new file hello.js
and write the following code:
console.log("Hello, World!");
To run the file, use the node command followed by the filename:
node hello.js
If everything is working correctly, you’ll see Hello, World!
printed to your console.
Free Resources