To install nodejs on Windows Server 2019, use the official 64-bit LTS installer and test both Node.js and npm from a fresh PowerShell session. You can go from a clean RDP server to a working local web app in about ten minutes, without exposing a new internet port.
Prerequisites
- A patched, 64-bit Windows Server 2019 installation.
- An RDP session and a local Administrator account, or an account that can approve User Account Control and run an elevated installer.
- At least 2 GB of free disk space and outbound HTTPS access so the server can download the MSI and npm packages.
- A domain name is not needed for the local test. If you will publish an application, prepare its domain, TLS certificate, and intended listening port first.
- A VPSLake Windows VPS with administrator access if you need a Windows Server environment for Node.js.
Step 1: Confirm Windows Server 2019 is 64-bit
The x64 MSI is the normal choice for a Server 2019 VPS, but checking first prevents installing a package for the wrong architecture.
Open Start → Windows PowerShell, then run:
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, OSArchitecture
Expected output resembles:
Caption Version OSArchitecture
------- ------- --------------
Microsoft Windows Server 2019 10.0.17763 64-bit
Continue only when OSArchitecture says 64-bit. If the server is 32-bit, do not force an x64 installer onto it; use a 64-bit server image before deploying current Node.js releases.
Step 2: Download the official Node.js LTS MSI
The LTS line is the safer starting point for a server because it prioritizes a longer maintenance window over the newest short-lived features.
Use a browser in the RDP session to open the official Node.js download page. Select the release marked LTS, then download Windows Installer (.msi) for x64. Save it in C:\Users\Administrator\Downloads or another folder you control.
If you prefer PowerShell, this command discovers the current LTS release from the official Node.js distribution index and downloads its x64 MSI:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$release = Invoke-RestMethod -Uri 'https://nodejs.org/dist/index.json' | Where-Object { $_.lts -and $_.files -contains 'win-x64-msi' } | Select-Object -First 1
$version = $release.version
$installer = Join-Path $env:TEMP "node-$version-x64.msi"
Invoke-WebRequest -Uri "https://nodejs.org/dist/$version/node-$version-x64.msi" -OutFile $installer
Get-Item $installer | Select-Object Name, Length
The final line should show an MSI with a non-zero size. The $version value includes the leading v, which is part of the official file name.
Step 3: Install Node.js and npm
The MSI adds the runtime and npm to the machine PATH, so applications and new terminal sessions can find them without custom environment variables.
If you downloaded the MSI with PowerShell in Step 2, launch its normal setup wizard with:
Start-Process msiexec.exe -ArgumentList "/i `"$installer`"" -Wait -Verb RunAs
Otherwise, open the downloaded .msi in File Explorer. In the wizard:
- Select Next, accept the license, and keep the default destination
C:\Program Files\nodejs\. - Leave Node.js runtime, npm package manager, and Add to PATH selected.
- Leave Tools for Native Modules clear unless an application specifically needs to compile a native C or C++ addon. Those tools are not required for ordinary JavaScript packages.
- Select Install, approve the elevation prompt, and choose Finish.
The installer does not create a Node.js service or open an inbound Windows Firewall rule. Close old PowerShell and Command Prompt windows before checking the PATH, because they keep the environment from when they were opened.
Step 4: Check Node.js, npm, and the PATH
A new terminal verifies that the installation completed and that Windows resolves the expected executable rather than an older copy elsewhere on the server.
Open a new Windows PowerShell window and run:
node --version
npm --version
Get-Command node | Select-Object -ExpandProperty Source
The exact release numbers change over time. A successful result looks like this:
vMAJOR.MINOR.PATCH
N.N.N
C:\Program Files\nodejs\node.exe
The first line must begin with v, the second must be a numeric npm version, and the final line should point to C:\Program Files\nodejs\node.exe.
Step 5: Run a localhost Node.js application
Executing a small HTTP server proves that the runtime works and keeps the test private by binding only to the loopback address.
In PowerShell, create the test application:
New-Item -ItemType Directory -Path C:\node-demo -Force | Out-Null
@'
const http = require("http");
const server = http.createServer((request, response) => {
response.writeHead(200, { "Content-Type": "text/plain" });
response.end("Node.js is running on Windows Server 2019\n");
});
server.listen(3000, "127.0.0.1", () => {
console.log("Listening on http://127.0.0.1:3000");
});
'@ | Set-Content -Path C:\node-demo\server.js -Encoding utf8
Set-Location C:\node-demo
node .\server.js
Leave that window running. You should see:
Listening on http://127.0.0.1:3000
Open a second PowerShell window and request the page locally:
(Invoke-WebRequest -UseBasicParsing http://127.0.0.1:3000).Content.Trim()
Expected output:
Node.js is running on Windows Server 2019
Press Ctrl+C in the server window when the test is complete. The test listens only on 127.0.0.1, so another computer cannot reach it and no firewall exception is needed.
Verify Node.js on Windows Server 2019
Run this final check from the account that will operate the application. It confirms the platform, CPU architecture, runtime version, and npm’s ability to create a local project manifest:
node -e "console.log(process.platform); console.log(process.arch); console.log(process.version)"
Set-Location C:\node-demo
npm init --yes
Get-Content .\package.json
The first three lines should be win32, x64, and a v-prefixed version. The last command should display JSON containing a project name and a version field. For API and runtime behavior, use the official Node.js documentation.
Troubleshooting
node is not recognized as the name of a cmdlet
The terminal was probably open before the MSI updated PATH, or the installation did not finish. Close every terminal, open a new PowerShell window, and run Get-Command node; if it still fails, check whether C:\Program Files\nodejs\node.exe exists and repair Node.js from Settings → Apps → Apps & features → Node.js → Modify.
npm.ps1 cannot be loaded because running scripts is disabled
PowerShell’s execution policy is blocking the npm PowerShell shim, not Node.js itself. Use npm.cmd --version for a one-time check, or allow signed local scripts for your user account with Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned, then open a new terminal and retry npm --version.
npm ERR! code EACCES or EPERM
The project or its dependency directory is protected or locked. Put application code in a dedicated writable folder such as C:\Apps\YOUR_APP, install dependencies locally with npm install, close editors that may hold files open, and avoid making a global package directory writable by every user.
The app works on the server but not from another computer
The sample deliberately binds to 127.0.0.1, which accepts local requests only. For a real deployment, bind the application to the interface your design requires, terminate TLS at a reverse proxy, and create the narrowest inbound rule in Server Manager → Tools → Windows Defender Firewall with Advanced Security; also check any firewall in the VPS control panel.
Hardening
- Keep the server patched and use an actively supported Node.js LTS line; review the release notes before changing major versions.
- Run the application with a dedicated, least-privileged Windows account instead of Administrator, and keep secrets in protected environment variables or a secret manager.
- Leave port 3000 closed when the application is local. If it must be public, expose only the TLS reverse-proxy port and restrict backend access to the proxy host.
- Keep npm dependencies local to the application and review the lockfile before upgrades.
FAQ
Should I install the LTS or Current Node.js release on Server 2019?
Choose LTS for most production applications because it is the maintenance-oriented release line. Use Current only when the application explicitly needs a newer feature and its dependencies support that release.
Is the x64 installer compatible with Windows Server 2019?
Yes, provided the operating system is 64-bit and patched. Confirm the architecture in Step 1 before downloading; an x86 or ARM64 MSI is not the correct choice for a normal x64 VPS.
Does installing Node.js start a server or open a firewall port?
No. Node.js is a runtime, and the MSI does not publish an application or add an inbound rule. A port is used only when one of your scripts starts a network service, and you should then configure its binding and firewall policy deliberately.
Do I need the native build tools option?
Only when an npm dependency must compile a native addon and does not provide a compatible prebuilt binary. Start with the runtime and npm components; add the toolchain later according to that package’s documented requirements.