The Ultimate Guide to Node.js Setup (Step by Step Tutorial)

4 min read
guide to node.js setup

Node.js is an open-source, runtime environment. It is used for developing networking and server-side applications. Node.js uses a non-blocking (asynchronous), an event-driven, input-output model. This model makes it lightweight and efficient, ideal for data-intensive real-time applications that run over distributed devices.

Node js provides a runtime environment for building a highly scalable server-side application using JavaScript. It can also be utilized to develop various kinds of applications such as web application, command-line application, real-time chat application, REST API server, etc.

However, it is largely utilized to design network programs such as web servers, similar to PHP, ASP.NET, and Java, etc.

DomainRacer is a best recommendation and example of a famous cheap node js hosting India provider that offers a generally modest essential computing tier Node.js solution.

What Can Node.js Do?

  • Node.js can be used to generate dynamic page content.
  • Node.js can be used to create, open, read, write, delete, and close files on the webserver.
  • Node.js can also be used to delete, add, and modify data in your database.

When you are going to use any development tool that is based on JavaScript then you will need npm and Node.js. In many shared web hosting accounts, you can create SSH Keys trough the cPanel account and access your account via Terminal.

To install Node.js on the hosting server, the SSH access is necessary. Now you need to ask your web hosting provider to enable SSH on your account. 

When you are going to node.js setup for your applications, the first step you need to do is the node.js setup framework. The Node.js framework is available for various operating systems such as windows, ubuntu and Mac OS. 

When you have installed node.js framework then you can build your first node.js application.

Node.js Setup on Windows:

While most hosts just offer Node.js Hosting on their VPSes, DomainRacer has an advanced cheap linux hosting server for Node.js. DomainRacer even tried and reported a simple Node.js setup process so you can get serious creation.

To node.js setup first, you need to install node.js libraries on the client system. Follow the below steps to install node.js on the system.

Step 1:

First, you need to download some necessary binary files from the website https://nodejs.org/en/download/. In this article, you will find an example of 32-bit node.js setup files on windows.

Step 2:

To start the installation process, you need to double click on the downloaded .msi file. Now click on the “Run” tab on the first screen.

Step 3:

In the next step you need to click on the “Next” button to continue installation.

Step 4:

To continue installation accept the license agreement and click on the Next button.

Step 5:

Now choose the location where you want to node.js setup and then click on the Next button.

1. For installation of Node.js enter the file location. At this location after the installation, the files for Node.js will be stored.

2. Click on the Next button.

Step 6:

Allow the default components and press on next button.

Step 7:

Now click the Install button.

Step 8:

Click on the Finish button. Now the installation process is completed.

Step 9:

Now you need to open your command prompt at NODSJS_HOME or anywhere and Run “node.exe” command.

Now you will see “>” prompt, this means that your node.js setup base environment is done.

To check the node.js version that is installed on your machine, use the following command from Command prompt.

node –v

When you want to exit from Node: then you can type “process.exit()” command to exit from Node CLI.

To exit from node you can also use Ctrl + D OR use Ctrl + C twice.

Installation on UNIX/Linux/Mac OS:

Depends on your operation system architecture you need to download and extract node version

-v6.3.1-osname.tar.gz into /tmp

And need to move extracted file into /usr/local/nodejs directory.

For that you can consider the following example:

$ cd /tmp
$ wget http://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.gz
$ tar xvfz node-v6.3.1-linux-x64.tar.gz
$ mkdir -p /usr/local/nodejs
$ mv node-v6.3.1-linux-x64/* /usr/local/nodejs

Verification of Node.js Setup

For verification you need to create a node.js file that named main.js on your machine that having below code.

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

Now you need to execute main.js file using Node.js interpreter. You will see the following result −

$ node main.js

If verification of node.js setup is good, then this example will produce the following result −

Hello, World!

The above is the node.js setup tutorial to install node.js on windows system. By using that steps user can easily install node.js on their machine.

For the choice of best Node.js hosting provider, I recommend DomainRacer from my experience and research. They offer the fastest hosting server, great website experience and cheapest cost that makes DomainRacer stand out as best among all Node.js hosting providers.

Leave a Reply