How to Install Node.js and npm on Windows Server 2025

Node.js is a cross-platform JavaScript runtime built on Chrome’s V8 engine, widely used for building server-side web applications, REST APIs, command-line tools, and automation scripts. Installing Node.js on Windows Server 2025 is straightforward, but production deployments benefit from additional configuration — including version management with nvm-windows, proper npm global package paths, and running Node.js applications as persistent Windows Services. This guide walks through every step from a fresh Windows Server 2025 installation to a running Express application managed by PM2.

Prerequisites

  • Windows Server 2025 (Standard or Datacenter) with an administrator account
  • PowerShell 5.1 or PowerShell 7.x
  • Internet access, or access to an internal mirror for offline installs
  • Windows Firewall access to allow outbound HTTPS (port 443)
  • At least 500 MB free disk space

Step 1: Download and Install Node.js Using the Official Installer

The simplest way to get Node.js on Windows Server 2025 is the official MSI installer from nodejs.org. Always choose the LTS (Long Term Support) release for production servers — it receives security patches for 30 months.

  1. Open a browser and navigate to https://nodejs.org/en/download.
  2. Download the Windows Installer (.msi) — LTS — 64-bit package (e.g., node-v20.19.1-x64.msi).
  3. Run the MSI. Accept the license, keep the default install path (C:Program Filesnodejs), and ensure npm package manager and Add to PATH are selected.
  4. The installer also offers to install Chocolatey and build tools for native modules — select this if you plan to compile C++ addons.

After installation, verify both Node.js and npm are available:

node --version
# v20.19.1

npm --version
# 10.8.2

Step 2: Install nvm-windows for Version Management

On production servers that host multiple Node.js applications, you often need to run different Node.js versions side by side. nvm-windows (Node Version Manager for Windows) provides this capability through a dedicated installer.

  1. Download nvm-setup.exe from https://github.com/coreybutler/nvm-windows/releases.
  2. Run the installer. It will detect any existing Node.js installation and ask whether to control it.
  3. After installation, open a new PowerShell session as Administrator.
# List available Node.js LTS versions
nvm list available

# Install Node.js 20 LTS
nvm install 20

# Install Node.js 22 LTS (latest)
nvm install 22

# Switch to Node.js 20
nvm use 20

# Confirm active version
nvm list
node --version

nvm-windows stores each Node.js version under %APPDATA%nvmv20.x.x and switches the active version by updating a symlink at C:Program Filesnodejs.

Step 3: Configure npm Global Package Location

By default, npm installs global packages into a folder that requires administrator privileges to write to. For day-to-day server operation, it is better to redirect global packages to a directory your service account can write without elevation.

# Check current global prefix
npm config get prefix
# C:UsersAdministratorAppDataRoamingnpm

# Set a custom global prefix (optional — useful for non-admin service accounts)
$npmGlobal = "C:npm-global"
New-Item -ItemType Directory -Path $npmGlobal -Force
npm config set prefix $npmGlobal

# Add the new prefix to the system PATH permanently
[System.Environment]::SetEnvironmentVariable(
    "Path",
    [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";$npmGlobal",
    "Machine"
)

# Reload PATH in current session
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")

Step 4: Configure the npm Registry

Enterprises often use an internal npm registry (Nexus, Artifactory, Verdaccio) to proxy the public registry and host private packages. Configure npm to point to your internal registry:

# View current registry
npm config get registry
# https://registry.npmjs.org/

# Set an internal registry
npm config set registry https://nexus.corp.example.com/repository/npm-proxy/

# Authenticate with the internal registry
npm login --registry=https://nexus.corp.example.com/repository/npm-proxy/

# Verify registry configuration
npm config list

If you need per-project registry overrides, create a .npmrc file in the project root:

registry=https://nexus.corp.example.com/repository/npm-proxy/
//nexus.corp.example.com/repository/npm-proxy/:_authToken=YOUR_TOKEN_HERE

Step 5: Install Common Global npm Tools

Several npm packages are typically installed globally on a Node.js server to support application deployment and development workflows:

# Process manager for production Node.js apps
npm install -g pm2

# TypeScript compiler
npm install -g typescript

# Development auto-restart utility
npm install -g nodemon

# Verify installations
pm2 --version
tsc --version
nodemon --version

# List all globally installed packages
npm list -g --depth=0

Step 6: Create and Run a Simple Express Application

Test your Node.js installation by creating a minimal Express web server:

# Create project directory
New-Item -ItemType Directory -Path "C:appshello-express" -Force
Set-Location "C:appshello-express"

# Initialize npm project
npm init -y

# Install Express
npm install express

# Create the server file
@'
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;

app.get('/', (req, res) => {
  res.json({ message: 'Hello from Windows Server 2025', node: process.version });
});

app.listen(port, () => {
  console.log(`Server running on port ${port}`);
});
'@ | Set-Content -Path "app.js"

# Run the server
node app.js

Open a second PowerShell window and test:

Invoke-WebRequest -Uri "http://localhost:3000" | Select-Object -ExpandProperty Content

Step 7: Run Node.js as a Windows Service with PM2

For production workloads, Node.js processes must survive reboots and be managed by the Windows Service Control Manager. PM2 integrates with Windows via a startup script:

# Start the app with PM2
Set-Location "C:appshello-express"
pm2 start app.js --name "hello-express"

# Check PM2 process list
pm2 list

# View application logs
pm2 logs hello-express

# Generate Windows startup script
pm2 startup windows

# IMPORTANT: Run the command that pm2 startup outputs, then save the process list
pm2 save

# Verify PM2 service is registered
Get-Service -Name "PM2*"

PM2 creates a Windows Service named PM2 that starts automatically at boot and relaunches any registered applications.

Step 8: Open Windows Firewall for Node.js Applications

If your Express application needs to be reachable from other machines, allow traffic through the Windows Firewall:

# Allow inbound TCP on port 3000
New-NetFirewallRule `
    -DisplayName "Node.js Express App" `
    -Direction Inbound `
    -Protocol TCP `
    -LocalPort 3000 `
    -Action Allow `
    -Profile Domain,Private

# Verify the rule was created
Get-NetFirewallRule -DisplayName "Node.js Express App"

Step 9: Updating Node.js and npm

Keep Node.js up to date by using nvm-windows to install newer versions without removing old ones:

# Check for newer versions
nvm list available

# Install latest LTS
nvm install 22

# Switch to new version (stops running services first)
pm2 stop all
nvm use 22
node --version

# Reinstall global packages on the new version
npm install -g pm2 typescript nodemon

# Restart services
pm2 start all
pm2 save

To update npm itself without changing Node.js:

npm install -g npm@latest
npm --version

Conclusion

You now have a fully configured Node.js environment on Windows Server 2025, complete with nvm-windows for version management, a properly scoped npm global prefix, an internal registry configuration, and a production-ready Express application running as a managed Windows Service under PM2. This foundation supports everything from single-page application backends to microservices — and because nvm-windows lets you maintain multiple Node.js versions simultaneously, you can safely test upgrades before rolling them out to production applications.