Install Node.js on Windows:
In this post, we are going to see how to install node.js on windows. Here we are going to pay more attention to the latest version of Windows that is Windows 10 1907 and the latest version of Node.Js that is 10.16.1 LTS. This post is divided into several sections for the convenience of the reader. The first section talks about what is Node.Js and what are the benefits of choosing it above the other popular offerings such as Apache and PHP etc.
What is Node.Js?
Initially, when PHP and apache were popular, they had a limitation of 10,000 concurrent connections because each request needs to be executed in its own call stack and the stack will occupy the hardware resource until the code is completely executed. This makes it difficult to use a low spec server for high traffic sites. Dahl aimed to solve this problem by using the open-source Chrome V8 engine to write a server that works by the non-blocking architecture. That means that a new request does not need the older request to be completed and it can execute in the same thread.
Also, since the Node.Js is based on the opensource V8 Engine developed by google for its runtime purposes, Node.Js is able to reap the benefits of writing non-blocking JS code with the help of asynchronous, call back functions and more. This is what gives Node.Js the ability to handle high traffic for the same hardware specs.
We need to keep in mind that Node.Js is only one part of the equation. If we need to write a fully functional website, we have to write a server and the code that will help the site to function as well. With Node.Js writing a powerful server is very easy and since we are using JS which is actually the client-side language, we can easily only learn one language and code for the server and the client unline with the other web development stacks.
There are lots of developers who contribute to the Nodel.Js libraries and keeping it relevant in today’s changing world. And as a Node.Js developer, to get the benefits of all the latest Node.Js features, you have to install a package manager for Node.Js. All the new features along with the Node.Js server are served to everyone as packages. These packages are managed using the package manager. The Node.Js package manager is called NPM. NPM stands for Node Package Manager.
Now that we have understood what are the benefits of using Node.JS let us see how to install Node.Js.
Install Node.Js on Windows using the Setup File:
We can go to the Node.Js official website and download the latest version of Node.Js. We can see that there are two downloads available. One is the Long Time Support and One is the Current. Current is the latest version of Node.Js. Let use click on it and get the Setup File.
By clicking on current we get the MSI (Microsoft Installer) set up file. Double click the setup file to initiate the installation.
- Now click on Next.
- Accept the terms and conditions and click on Next
- Let it be the default file path and click on Next
- Click on Next
- Now click on Next.
- Now click on Install.
- Now click on Finish.
After that step, we can see that Node.Js is installed in Windows 10. Press the start button and search for Node and you will find Node.Js here.
Install Node.Js using Chocolatey:
We do not have to completely rely on only the setup file for installing Node.Js in Windows. We can also use the Node Package Manager for Windows for installing Node on Windows. The package manager for Windows is called Chocolatey.
Chocolatey is a decentralized package manager for quickly installing the necessary packages. To install Node.Js using Chocolatey we need to install Chocolatey first. We can install it from this link.
If we click on the link provided we can see that It will navigate to another page that contains the instructions on how to install Node.Js using Chocolatey. But we do not have to bother with the nitty-gritty details of installing our necessary software and we will follow the given instructions to install Node.Js on Windows.
- Press the start button and type cmd.
- Enter the following command in Command Prompt and press enter
- After the command completes executing, enter choco and press enter.
- If you see the following output, then Chocolatey has installed in the system.
- Now enter the following command to install Node.Js
- Now you will see a prompt asking you to enter y/n.
- Enter y
That is all, the Node.Js has installed successfully in your system also.
Writing the first Node.Js Web Site:
In this section, we will write our first Node.Js website. Now that we have successfully installed Node.Js on our Windows computer, let us write our first Node.Js site.
Below is the source for the first program.
In our case, we have saved it in a file named TecKangaroo.Js and saved it in the Documents folder.
- Now we launch Node.Js in the current directory and enter the following command.
- Now open a browser and enter the following address.
Now you will see an output as shown in the image. This means that Node.Js server is running and returning the following response.
In this post, we learned how to install the latest version of Node.Js on the latest version of Windows. We also learned what is Node.js and how it is different from the other servers and programming languages.
Since it is using Js as the primary language, we can say that now we have a way to script for the server and the client using the same language.
If you want more such awesome posts, please stay tuned to TecKangaroo.com
Install Node.js On Windows
- Author Rating
- Content Rating
- Content Relevance
- Install Node.js on Windows