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:
If there is no Node.js in the system, you will see similar output:
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:
You can now see all versions of Node.js available for installation.
Choose the latest LTS version and install it using the command nvm install :
Now activate the installed version.
Now you can make sure that everything was installed correctly, and at the same time see the versions of Node.js and npm:
npm --version
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.
Now let’s check installed versions:
And switch to the new one: