11.12.2024

How to Install Node.js on Windows Server 2019

For the purposes of training or exploring the possibilities, you can install a Node.js directly in Windows. In this tutorial, we'll look at how to do this, using Windows Server 2019 as a basis.

It is assumed that no Node.js have been installed on the system. If this is not the case, you must first uninstall the old version by following the guide. This is necessary because after installing NVM, version conflicts may occur. If you are not sure, you can check with command in PowerShell:

node --version

If there is no Node.js in the system, you will see similar output:

Screenshot 1. Node does not exist in the system.

Installing nvm-windows

There are different ways to set up Node.js. Using the Node Version Manager (NVM) is the most easy and universal, so we will use it. Original NVM does not work on Windows. But that is why the nvm-windows is being developed.
So go to the nvm-windows Releases page.

Download the nvm-setup.zip file from the latest release.

Open the downloaded archive, run the nvm-setup.exe file and follow the instructions of the installer. By default, the optimal values are selected, which should not be changed unnecessarily.

Node.js and npm installation

We will now install the latest LTS version of Node.js. Open PowerShell and enter the following command:

nvm list available

You can now see all versions of Node.js available for installation.

Screenshot 2. Available Node.js versions.

Choose the latest LTS version and install it using the command nvm install :

nvm install 14.16.0

Screenshot 3. Node.js installation.

Now activate the installed version.

nvm use 14.16.0

Now you can make sure that everything was installed correctly, and at the same time see the versions of Node.js and npm:

node --version
npm --version

Screenshot 4. Node.js and npm versions.

At this point, you have installed Node.js and npm on Windows Server 2019.Now let's see how you can have different versions of Node.js at the same time and switch between them. First, let's install a different version. For example, the latest one. It may have reliability issues, but it contains the latest features.

nvm install latest

Now let’s check installed versions:

nvm ls

Screenshot 5. Installed versions of Node.js.

And switch to the new one:

nvm use 15.13.0