The Node.js platform is available for a range of operating systems, from Windows to Ubuntu and OS X. Here I am providing the step-by-step guide of how to install node js in the windows operating system.

Lets start by downloading the latest version of node.js from the official website https://nodejs.org/en/ .

Step by Step Guide to Install node js in windows 10 1

Download the recommended version, in our case, it is 12.14.1 LTS.

Click on the downloaded .exe file and start installing the Node.Js.

Step by Step Guide to Install node js in windows 10 2
Click Next to continue the installation process

Step by Step Guide to Install node js in windows 10 3
Accept the terms and conditions and click on Next button to continue installing

Step by Step Guide to Install node js in windows 10 4
Select the location for installing the application and click on Next


Install npm in Windows

Install npm Package Manager using node.js MSI installer

Step by Step Guide to Install node js in windows 10 5

As you can see in the above screen shot. it is also going to install the npm package manager in our system.

Lets click Next and continue the installation process.

Step by Step Guide to Install node js in windows 10 6

If you click on this checkbox it is going to install the chocolatey in your machine.

Windows package manager

Chocolatey is a command-line application installer for Windows-based on a developer-centric package manager called NuGet. Unlike manual installations, Chocolatey adds, updates, and uninstalls programs in the background requiring very little user interaction.

Click Next to continue on next screen

Step by Step Guide to Install node js in windows 10 7

Click on Install to finish the installation process

We are done with the installation process of Node.js and npm. Open a command prompt and type npm –version to ensure the successful installation of npm.

Step by Step Guide to Install node js in windows 10 8

Creating node.js hello world

Open Notepad and paste the below code to run the Node application.

var http = require("http");
http.createServer(function (request, response) {
   // Send the HTTP header
   // HTTP Status: 200 : OK
   // Content Type: text/plain
   response.writeHead(200, {'Content-Type': 'text/plain'});
   // Send the response body as "Hello World"
   response.end('Hello World from Beetechical\n');
}).listen(8081);
// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');

Save the file with .js extension to run the file on a node server.

Open the command prompt and navigate to the file location by using the cd command.

Step by Step Guide to Install node js in windows 10 9

Once you run the file using node, You should be able to open the application on http://127.0.0.1:8081 or http://localhost:8081.

Step by Step Guide to Install node js in windows 10 10

So, we are able to run our javascript application using a node server.

Conclusion

We hope this tutorial will help you to install node js in the windows environment. Also, how to write your first node js application and test it locally.

61 / 100

5 Comments

Comments are closed