How to install node.js on Windows 10

0
286

Hi. How are you? Today we are going to talk about node.js. This is a server-side JavaScript environment that uses an asynchronous, event-driven model. Besides, it is multi-platform, open-source, for the server layer (but not limited to it). It is also based on the ECMAScript programming language, with data I/O in an event-oriented architecture and based on Google’s V8 engine. Node supports TCP, DNS, and HTTP protocols. Additionally, not one of Node.js strengths is its ability to keep many connections open and waiting. Well, let’s see how to install Node.js on Windows 10.

Downloading node.js

The first thing you have to do is go to the node.js website and download the LTS version. At the time of writing this article, the version is 12.13.1

Download the latest version.
Download the latest version.

Then double click on the file to launch the wizard. Press Next to begin the installation.

Press next.
Press next.

Next, you accept the terms of the license.

Accept the license.
Accept the license.

Please set the installation directory. You can leave it by default or choose a different one.

Select the installation directory.
Select the installation directory.

Now, there are components to install. I recommend that you leave it by default as it is the most comfortable option.

Select the options to install.
Select the options to install.

The following table offers a very interesting option. In fact, the wizard offers to install some tools necessary for the operation of the program. Additionally, this will be done automatically and unattended. Please note that if you do not check this option, you will have to install the tools manually.

Allows the wizard to automatically install the necessary tools.
Allows the wizard to automatically install the necessary tools.

After the previous settings have been made, the wizard will start the installation.

Click Install to start the installation
Click Install to start the installation

The wizard will start the installation of the program.

The Wizard running the installation
The wizard running the installation

After a few seconds, the wizard will indicate that your work was successful and that the program has been installed.

Node.js successfully installed.
Node.js successfully installed.

Installing the extra tools

Once you press Finish to close the wizard, the installation of the extra tools will begin. Forthwith, a window will pop up indicating the installation of the Node.js Native Modules Script Installation. Just press any key to continue:

Press any key to start the installation
Press any key to start the installation

Next, it is explained that the script downloaded and installed Chocolatey to install the packages. Press any key to continue.

Installing chocolatey.
Installing chocolatey.

Once the above steps are completed, a PowerShell window will pop up that will download and install the packages through Chocolatey. As already mentioned, this is an automatic and unattended process. However, if an error occurs, just update Windows and run the installer again.

Installing extra modules
Installing extra modules

Installing Node.js using Chocolatey.

It is also possible to install Node.js on Windows 10 using the Chocolatey repository manager. To find out how to install and use it, please check out our tutorial. Well, to install just run this command in PowerShell.

 cinst nodejs install 

If the installation is successful, you will get the message of the successful installation of Node.js

Testing Node.js installation

After installing Node.js, let’s try it out. With that intention, open a CMD and type the following command:

node -v
npm -v
Testing the installation of Node.js
Testing the installation of Node.js

With these commands, we are seeing the version of Node.js and the version of the NPM package manager.

Testing the operation of Node.js

To check the functioning of the Node.js server and that it effectively executes javascript code, we will do the following. First, create a folder with the name node. Thereupon, place it in any direction, e.g. on the Documents.

Create a new folder on the Documents with the name "node".
Create a new folder on the Documents with the name “node”.

Then open the text editor of your choice and create a file with the following content:

console.log('correctly installed Node');
Creating a test file.
Creating a test file.

After adding the text, proceed to save it with any name in the folder called node. In this case, the name will be test. The most important thing is that the file extension should be .js At the end the file would be named test.js

Saving the test.js file in the node folder.
Saving the test.js file in the node folder.

Then open a Command Prompt and navigate to the folder location using the following commands:

cd documents
cd node
entering the location of the node folder
Entering the location of the node folder

It then executes the file we just created, using the following command:

node test.js
Running the test file
Running the test file

Finally, we have seen how to install Node.js on Windows 10. From now on, you can use this powerful Java execution environment. That’s all for now, I hope you enjoyed it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here