How to Set Up Node.js on a Windows Server?

0
22834

Node.js is a platform, which is based on the Chrome JavaScript runtime, and used to build networking applications with features of fast response speed and easy to expand. This platform can run on a variety of operating systems. We mainly focus on the ways and process to build a Node.js on Windows server in this post. By the way, Bisend offer professional Node.js hosting on both Linux and Windows platform, which means typically you have no need to do all below setup if you host your Node.js website on our web servers.

How to Get Initiated with Node.js?

It’s not a hard task and will only take you few minutes to set up Node.js. The following comes to the specific steps to set up node.js on a Windows server. Note that, the whole process of installation is basically the same, so you don’t need to worry about which your OS version is and what operating system you use.

1. Download a Windows Installer Package

First, you’re required to have your computer installed with Node. You should go to the Node.js page and choose the requisite installer and download it. The example below we choose to download the “windows Installer” package. Note that you should choose the most adaptive installer package for the setup course.
Download a Windows Installer Package

2. Operate Node.js Setup Wizard

In order to carry on, you should go to the “Downloads” section and find the installer package you’ve downloaded. Then click twice on it and open the setup wizard of it. You will see an installation window like this. Click “Next” and fulfill the whole “Setup Wizard”. If the progress of the installation is interrupted, you can open the previous package once again and click “Repair” to fix the possible problems that may exist.
Operate Node.js Setup Wizard

3. Get the Installation Progress Finished

After the installation is completed, click “Finish”. You’d better restart your computer before you use node.js under your command. This can enable you to refresh the Windows OS because its registry files have been adjusted in the process.
Get the Installation Progress Finished

How to Confirm Whether Node.js Is Working on Windows?

After you have finished installing node.js and Node Package Manager, you need to examine whether this Noda.js is taking effect or not. In the following, we choose a relatively simple Node.js application to show how to do this.

1. Build a Node.js Application

The first thing you need to do is to build a local folder for the chosen application. A designed location, such as “c:/desktop/node/test-app”, will enable the application to access to your files through “Windows Command Prompt”. In our following example, there is a folder named “test-projects” in “My Desktop” folder. In addition, we build a sub-folder named as “my-node-js-app” within this “test-projects” folder.
Set up a node.js application

2. Configure a Hello World Script

In order to make sure that your Node runs well on Windows, configure a hello world script or a “hello-world.js” file in the “my-node-js-app” folder above. What you need to do is only to copy and paste the below code to this “hello-world.js” file. Note that, the configuration code below is official code provided by Node.js.
Configure a Hello World Script

3. Execute Your Windows Command Prompt

By this time, you need to execute your first finished Node.js application. You can input node.js in the “Search Programs and Files” text box to find it. Then run the “Node.js Command Prompt” directly from your Windows “Start” menu.

Execute Your Windows Command Prompt

Here you can notice that your “Node.js Command Prompt” is a command line interface (CLL). To take advantage of this CLI, head to the referred Node.js application’s folder. Then, you just need to input the modified directory contents command like “cd \Desktop\test-projects\my-node-js-app” in the interface.
Input the modified directory contents command

4. Test the Hello World Script

Meanwhile, you should input the command as “node hello-world.js” to operate your “hello-world.js” file. If everything goes well, you’ll be told by the command line interface that “Server running at http://127.0.0.1:1337 now”. You can type http://127.0.0.1:137 in whatever web browser if you want. Then a browser window will be open and you can notice the “Hello World” text, which reflects that everything here is working well.

Test the Hello World Script

Once you have done all the mentioned steps smoothly, there is nothing you need to do. Up to now, Node.js on your Windows server is supposed to run well.

Suppose you are not satisfied with Node.js and need to uninstall this Node.js, click “Start” to find “Control Panel”, and click “Programs and Features”. Here, choose the icon with Node.js and click “Uninstall”. Then you just carry on according to direction in the tool-tip box.

Uninstall Node.js