How to Install Node.js on Windows Server 2022

Install nodejs on windows server 2022 with the official LTS MSI, verify npm and PATH, and run a private test app on your server in about ten minutes.
A glowing JavaScript runtime cube connects a Windows-style window to a blue-lit server rack.

To install nodejs on windows server 2022, download the official x64 LTS MSI and launch it from an Administrator PowerShell session. In about ten minutes, you will have Node.js, npm, a verified system PATH, and a localhost test server running without exposing a new public port.

Prerequisites

  • A patched, 64-bit Windows Server 2022 installation.
  • An RDP connection and a local administrator account that can approve User Account Control prompts and run elevated PowerShell.
  • At least 2 GB of free disk space for the runtime, npm cache, and a small test project, plus outbound HTTPS access to nodejs.org.
  • A domain name is not required for this local test. If you will publish an application, prepare the domain, TLS plan, and intended listening port separately.
  • A VPSLake Windows VPS with administrator access if you need a Windows Server environment for Node.js.

Step 1: Check Windows Server 2022 and the CPU architecture

The current Windows installer is architecture-specific, so confirm that this server is the usual x64 build before downloading anything.

Open Start → Windows PowerShell, then run:

Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, OSArchitecture

Expected output resembles:

Caption                         Version        OSArchitecture
-------                         -------        --------------
Microsoft Windows Server 2022  10.0.20348    64-bit

Continue when OSArchitecture is 64-bit. Do not install the x64 MSI on a 32-bit system; use a 64-bit Windows Server image before deploying a current Node.js release.

Step 2: Download the official Node.js LTS MSI

Selecting the LTS line gives a maintenance-focused release, while retrieving the file from the Node.js distribution index avoids third-party download sites.

In Administrator PowerShell, run this block to select the first current LTS release that publishes a Windows 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-AuthenticodeSignature -FilePath $installer | Select-Object Status
Get-Item $installer | Select-Object Name, Length

The signature status should be Valid, and the MSI size should be greater than zero:

Status
------
Valid
Name                    Length
----                    ------
node-vMAJOR.MINOR.PATCH-x64.msi  NNNNNNN

If you prefer the graphical route, open the official Node.js download page in the RDP session, choose the release marked LTS, and select Windows Installer (.msi) for x64. The download page is also the right place to choose a specific supported LTS version for an application with a fixed compatibility requirement.

Step 3: Install Node.js and npm

The MSI installs the runtime and npm together, adds C:\Program Files\nodejs\ to the machine PATH, and leaves application ports closed.

Start the downloaded installer from the elevated PowerShell window:

Start-Process msiexec.exe -ArgumentList "/i `"$installer`"" -Wait -Verb RunAs

When the setup wizard appears:

  1. Select Next, accept the license, and keep C:\Program Files\nodejs\ unless your server has a documented alternate layout.
  2. Keep Node.js runtime, npm package manager, and Add to PATH selected.
  3. Leave Tools for Native Modules clear for now. Select it only when an application specifically needs to compile a native C or C++ addon.
  4. Select Install, approve the elevation prompt, and then choose Finish.

The installer does not start an application service. Close any PowerShell or Command Prompt windows that were open before installation; those sessions retain the old PATH.

Step 4: Verify the runtime, npm, and PATH

A new terminal session confirms that Windows can find the machine-wide installation rather than an older copy in another folder.

Open a new Windows PowerShell window and run:

node --version
npm --version
Get-Command node | Select-Object -ExpandProperty Source

The exact release numbers change as Node.js publishes updates. A successful check looks like this:

vMAJOR.MINOR.PATCH
N.N.N
C:\Program Files\nodejs\node.exe

The first line must begin with v, npm must print a numeric version, and the final path should point to C:\Program Files\nodejs\node.exe.

Step 5: Run a private Node.js test server

A loopback-only HTTP server proves that Node.js can execute code and listen successfully while keeping port 3100 inaccessible from the internet.

Create the test folder and script in PowerShell:

New-Item -ItemType Directory -Path C:\node-check -Force | Out-Null
@'
const { createServer } = require("node:http");
const server = createServer((request, response) => {
  response.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
  response.end("Node.js on Windows Server 2022 is responding\n");
});
server.listen(3100, "127.0.0.1", () => {
  console.log("Listening on http://127.0.0.1:3100");
});
'@ | Set-Content -Path C:\node-check\server.js -Encoding utf8
Set-Location C:\node-check
node .\server.js

Keep that window open. It should print:

Listening on http://127.0.0.1:3100

Open a second PowerShell window and request the page locally:

(Invoke-WebRequest -UseBasicParsing http://127.0.0.1:3100).Content.Trim()

Expected output:

Node.js on Windows Server 2022 is responding

Press Ctrl+C in the server window when the check is finished. Because the process listens on 127.0.0.1, you do not need a Windows Firewall exception for this test.

Verify Node.js on Windows Server 2022

Run a final runtime check from the account that will own the application, then let npm create a local manifest. This checks the platform, architecture, Node.js release, and ordinary project-directory write access in one pass.

node -e "console.log(process.platform); console.log(process.arch); console.log(process.version)"
Set-Location C:\node-check
npm init --yes
Get-Content .\package.json

The first three lines should be win32, x64, and a v-prefixed version. The JSON should contain a project name and a version field. For runtime APIs and supported behavior, use the official Node.js API documentation.

Troubleshooting

node is not recognized as the name of a cmdlet

The shell was opened before the MSI updated the machine PATH, or the installation did not finish. Close all existing terminals, open a new PowerShell window, and run Get-Command node; if it still fails, check for C:\Program Files\nodejs\node.exe and repair Node.js from Settings → Apps → Installed apps → Node.js → Modify.

npm.ps1 cannot be loaded because running scripts is disabled

PowerShell is blocking npm’s script shim, not the Node.js executable. Confirm npm with npm.cmd --version, or set a user-scoped policy with Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned, open a new terminal, and retry npm --version.

npm ERR! code EACCES or EPERM

The project may be inside a protected folder, or another process may have locked a file. Keep the application under a dedicated path such as C:\Apps\YOUR_APP, install dependencies locally with npm install, close editors that hold files open, and avoid making a global package directory writable by every user.

The test works on the server but not from another computer

The sample intentionally binds to 127.0.0.1, which accepts only local requests. For a real deployment, bind the application to the required interface, put it behind a TLS-terminating reverse proxy, and create a narrow inbound rule in Server Manager → Tools → Windows Defender Firewall with Advanced Security for only the port and source addresses you need; also check the VPS control-panel firewall.

Hardening

  • Keep Windows Server 2022 patched and stay on an actively supported Node.js LTS line; review dependency changes before upgrading production applications.
  • Run the application under a dedicated least-privileged Windows account, not Administrator, and keep secrets in protected environment variables or a secret manager.
  • Keep project dependencies local and review package-lock.json changes before accepting updates.
  • Leave port 3100 closed. If a public service is required, expose only the reverse proxy’s TLS port and restrict backend traffic to that proxy.

FAQ

Which Node.js release should I use on Windows Server 2022?

Use the current LTS release for most server applications because it is the maintenance-oriented line. Choose Current only when the application requires a newer feature and its dependency stack explicitly supports it.

Does the Windows MSI install npm too?

Yes. The standard MSI includes npm when npm package manager remains selected in the component screen. Check both tools with node --version and npm --version from a newly opened terminal.

Does installing Node.js open port 3000 or 3100?

No. Node.js is a runtime, and the MSI does not publish an application or create an inbound firewall rule. A port becomes relevant only when your code starts a network listener, so set its bind address and firewall policy deliberately.

Do I need Tools for Native Modules?

Only if an npm dependency has to compile a native addon and does not provide a compatible prebuilt binary. Start with the runtime and npm, then add the toolchain according to that dependency’s build instructions if an install actually requires it.

Samrat Ghosh
Written by

Samrat Ghosh

Founder & Infrastructure Engineer

Samrat Ghosh is the founder of VPSLake, where he builds and runs the remote desktop and VPS hosting infrastructure the company is built on. He writes hands-on guides about RDP, Windows Server, VPS management and secure remote access - the practical documentation he wishes had…

Previous Article

How to Install Node.js on Windows Server 2019

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨