Home >>Nodejs Tutorial >Nodejs - Environment Setup

Nodejs - Environment Setup

Node.js Environment Setup

Node.js refers to an open-source and cross-platform environment, which can help anyone create to generate dynamic page content. It provides an excellent platform for beginners to start. Also, it is essential to understand the inputs and outputs of the node.js to unleash its full potential. So, here is the guide to node js environment setup.

Software needed for Node Js

You need the following software installed in your computer system for node.js environment config smoothly:

  1. Text editor : You can use Windows NotePad, EMACS, Epsilon, or any other software. The text editor will be the space where one can type the program.
  2. The Node.js Runtime :The source code written in the source file is simply javascript. The Node.js interpreter will be used to interpret and execute your javascript code. The source code you will write is the javascript. The Node.js interpreter's role is to understand and implement the javascript code you have written.

Setting up Node.js on Windows

  • Node.js development environment can be installed in Linux, Windows, Solaris, and Mac OS systems.
  • You need to visit the official website of node.js, which and it will automatically detect the operating system you are using. And it will display a download link for you, depending on the OS you are using.
  • After downloading the latest version of the application available for your OS, you need to double click on the file downloaded, and it will prompt an dialog box.
  • It will display a few license agreements before the installation to take place. You need to agree to the installation agreements and click on Next.
  • The next step will show you the path for the node.js. By default, the installer application will want to install Node.js in C:\Program Files\nodejs on the computer. However, you can set the path for node js according to your preference.
  • After you have set node js path, click on Next.
  • 7. The next step will be shown to choose the features you will like to have in your computer system. To create any Node.js application, we need at least a Node.js runtime and npm package manager, so you need to proceed with the default node js environment config selected and click on the Next button.
  • Next, you need to click on the Install button provided at the bottom right of the dialog box.
  • It will start installing the Node.js right away on your device, and in the end, click on finish and the end of the installation.
  • After you have installed node js set env variable according to your preference and you can use it however you want.

Setting up Node.js on Linux

  • Visit the official website of Node.js and go to the download page. It will automatically detect your Linux OS and will show you the installer file to download.
  • After the completion of the download, click on the installer file and open it.
  • It will show you a download wizard, and you will have to follow the steps to install.
  • It will display a few license agreements before the installation to take place. You need to agree to the installation agreements and click on Next.
  • The next step will show you the path for the node.js. After you have chosen the location of installation, click on next.
  • After you are done with all these, click on the Install button.
  • It will start installing the Node.js right away on your device.
  • In the end, it will display the summary of the installation, where the application is installed.
  • Click on the close button and this end of the installation.

Verifying the installation of Node.js

After you have installed the Node.js program on your computer, you need to confirm whether the application has been installed successfully or not. To do so, open the command prompt and type:

 node -v

If the Node.js is installed successfully, it will display the version of Node.js in your system.

Verify installation: Executing a File

Here is an example to create first program in node.js file name first.js having the following code.


/* Hello, World! program in node.js */
console.log("Hello, World!")

execute first.js file using Node.js interpreter to check the result


$ node main.js

Output : Hello, World!