Skip to main content

Dedicated Server: Installation of JavaScript

This guide was created with the following products:

(Details may vary with products from different providers but the main concepts remain the same)

Introduction

This guide provides steps for the installation of Node.js, Deno and Bun on Windows. The steps provided below must be executed via RDP, if you don't know how to connect to your server via RDP, please have a look at our Initial Access (RDP) guide.

Installation

To begin, you need to decide which JavaScript runtime to install. There are plenty of online resources describing each one in much detail. But you can also read this guide because it will include basic usage commands and code examples. We can recommend using Node.js as it is one of the most widely used and a very popular choice.

Installing Node.js Runtime

Step 1: Downloading Files

Open up the browser of your choice (I'm going to use Chrome for this guide) and head over to https://Node.js.org/en

Now click on the Download Node.js (LTS) button and wait for it to finish.

tip

It is generally recommended to keep your installation on the latest Long Term Support (LTS) version.

Step 2: Installing Python

Run the installer by clicking on it. Now you will be prompted to set a few settings for the installation. On the Welcome page you should click Next.

Now you need to read and accept (by marking the checkbox) the Node.js License Agreement and then click on the Next button.

After that you will be asked for a location to install Node.js.

note

We recommend using the default install location.

On the next page, you can opt out of installing some of Node.js core packages. If you want a normal installation, which is recommended, simply press on the Next button. You will also have an option to install Chocolatey, but this is not needed.

Step 3: Completing Installation

That's all you can now click Install and wait for everything to be set up. Be patient as this may take some time. :)

Once finished, you can simply press Finish on the final page and start using Node.js on your server.

Update Node.js to latest version

Running node -v will show you the installed version of Node.js. From time to time, you should check that you're running the latest LTS version. To update Node.js, you need to follow the provided Install JavaScript guide section again.

Running Node.js & npm

npm is the official package manager of Node.js. You will use it for installing any packages from the internet.

tip

You can find all npm packages on their website.

Creating a new project

Every time you want to start a new Node.js project you need to make a new directory for it using the File Explorer, open the Command Prompt or PowerShell into it and run the npm init command to begin the setup. This will ask you for some basic info for creating a package.json file. This will be the "config" file for running Node.js.

tip

On Windows, clicking once on the File Explorer current path and typing cmd then pressing Enter will open the Command Prompt inside the current directory, making it easier.

After initializing the new project, you can make a new file called index.js and write code inside it. As an example, we will create a simple http server on default port 80 which replies with a test message when accessed via localhost. This can be seen below.

const http = require('http')

const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('Hello from ZAP-Hosting Docs =)')
})

server.listen(80)

Now you can run the provided code with the node . command and check the results by going to localhost:80 in your browser.

tip

Installing external packages from npm is done with the npm install [package-name]

Conclusion

Congratulations, you have successfully installed JavaScript. For further questions or assistance, please don't hesitate to contact our support team, which is available daily to assist you! 🙂