How to Setup Node.js Server on your Local Windows or Linux Machine

Nodejs server setup

Hello, friends how are you today !!! so today I just thought that there should be something other than hacking so this article is for all those programming lovers and also you can use this tutorial to setup your own API testing server. In this articles, we are going to learn How to Setup Node.js Server on your Local Windows or Linux Machine so without further due let us get started.


What is Node.js?

Let’s dive into the boring stuff:

Node.js is a JavaScript platform built on Chrome’s JavaScript runtime for easily building fast and salable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Mostly is being used to develop API’s for applications and it is a server-side platform, Node.js is an open source, a cross-platform runtime environment for developing server-side and network applications.

There are many libraries written in Node.js for support and functionality for developing Node.js applications.

JavaScript is becoming a go-to language for web developers. Front-end developers use it to add animations and user interface enhancements, add interactivity, and talk to the back-end server to get information using AJAX.  Developers who work on the server-side are also shifting to JavaScript because of the efficiencies and speed offered by JavaScript’s event-driven, non-blocking nature.

Node.js is also used for developing desktop applications and for deploying tools that make developing websites simpler and easier. For example, by installing Node.js® on your desktop machine, you can quickly convert CoffeeScript to JavaScript, SASS to CSS, and shrink the size of your HTML, JavaScript, and graphics files. Using NPM — a tool that makes installing and managing Node modules — it’s quite easy to add many useful tools to your web development toolkit.

What should you know before getting into it?

You should know that Node is not an application that you can pin into the taskbar and use it like MS Word or Photoshop. It is a command line application and you should know the basics to use Command line.

Setup Node js Server local Windows / Linux machine:-

Installation on Windows:-

Installing Node.js on windows is pretty straightforward as Node.js provides an installer for windows on their website.


  1. Download the windows installer from the Node.js website.
  2. Run the installer (the .msi installer that you downloaded from the website.)
  3. Follow the prompts in the installer (Accept the license agreement with default installation settings.)Node.js Installer
  4. Restart your computer. You won’t be able to run Node.js® until you restart your computer.

Testing it!!

To make sure that the NPM and Node have been installed successfully on your system you can check this just by typing commands in the command prompt.

  • Test Node. To see if Node is installed, open Windows Command Prompt, Powershell, and type.node -v This should print the version number, something like v8.9.1 .nodeversion
  • Test NPM. And to test NPM just type innpm -v the Command Prompt or Powershell and it will show you something like this.5.5.1npm version
  • Create a test file and run it. A simple way to test that node.js works is to create a JavaScript file: name it,hello.js and just add the code.console.log('Everything Up and running'); To run the code simply open your command line program, navigate to the folder where you save the file and type.node hello.js This will start Node and run the code in the filehello.js. You should see the output.Everything Up and runninghellojs test file

And if your are still having this issue here is the video that you can follow:-

How to Update:-

Just got to the Node website and download the latest version and install it.

How to uninstall:-

Simply go to your control panel and uninstall the Node.js package.

Also Read: Top Kali Linux Tools Every Hacker Should Know About and Learn

Installation On Linux:-

The best operating system out there for developers so let’s get started how to install Node.js on Linux. Ubuntu contains version of Node.js in its default repositories that can be easily used.

In order to get it installed, we just need to use the apt package manager on Debian Linux distros. First get updates form the servers and refresh local package index.

sudo apt-get update

sudo apt-get install nodejs

If the version of Nodejs in the repositories suits your needs, this is all that you need to do to get set up with Node.js. and in most cases you will also install npm which is Node.js package manager typing:

sudo apt-get install npm

This will allow you to easily install modules and packages to use with Node.js.

Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. Keep this in mind as you are running software.

Below, we’ll discuss some more flexible methods of installation.

Install Using PPA:-

An alternative way that you can you to install Node.js and you can get the more recent version of Node.js and its added in your PPA (Personal package archive).

First, you need to install the PPA in order to get access to its contents. This depends on the version you wish to install.

For the most recent LTS (8.x version) use:

curl -sL | sudo -E bash -

For the currently active version release (9.x version) use:

curl -sL | sudo -E bash -

After you have added this to your PPA you just need to run this command to install it.

sudo apt-get install nodejs

As this packagenodejs contains the nodejs binary and npm so we don’t have to install it separately. But in order to for npm to work properly, we will have to install the required libraries on the system.

sudo apt-get install build-essential

How To Install Using NVM

An alternative to installing Node.js through apt is to use a specially designed tool called nvm, which stands for “Node.js version manager”.

Using nvm, you can install multiple, self-contained versions of Node.js which will allow you to control your environment easier.

First, we need some packages to be installed on the system.

sudo apt-get update
sudo apt-get install build-essential libssl-dev

Now we want to run the nvm installation file so we have to download it from GitHub:

curl | sh

This will download the script and run it. It will install the software into a subdirectory of your home directory at ~/.nvm. It will also add the necessary lines to your ~/.profile file to use the file.

To gain access to the nvm functionality, you’ll need to log out and log back in again, or you can source the ~/.profile file so that your current session knows about the changes:

source ~/.profile

Now that you have nvm installed, you can install isolated Node.js versions.

To find out the versions of Node.js that are available for installation, you can type:

nvm ls-remote
. . .

As you can see, the newest version at the time of this writing is v0.11.13. You can install that by typing:

nvm install 0.11.13

Usually, nvm will switch to use the most recently installed version. You can explicitly tell nvm to use the version we just downloaded by typing:

nvm use 0.11.13

When you install Node.js using nvm, the executable is called node. You can see the version currently being used by the shell by typing:

node -v

If you have multiple Node.js versions, you can see what is installed by typing:

nvm ls

If you wish to default one of the versions, you can type:

nvm alias default 0.11.13

This version will be automatically selected when a new session spawns. You can also reference it by the alias like this:

nvm use default

Each version of Node.js will keep track of its own packages and has npm available to manage these.

You can have npm install packages to the Node.js project’s ./node_modulesdirectory by using the normal format:

npm install express

If you’d like to install it globally (available to the other projects using the same Node.js version), you can add the -g flag:

npm install -g express

This will install the package in:


Installing globally will let you run the commands from the command line, but you’ll have to use link the package into your local sphere to require it from within a program:

npm link express

You can learn more about the options available to you with nvm by typing:

nvm help
Thats all and now you can get started and create new and intresting application using Node.js and learn new things.


  1. Every dev person should use NVM only. It won’t require sudo in any npm install -g command. There is also an nvm-windows version which is not exactly the same thing but behaves almost the same.


Please enter your comment!
Please enter your name here