WindowsMay 27, 2026 10 views

Installer Node.js sur Windows Server

Installer Node.js sur Windows Server

Quick Summary: Install Node.js on Windows Server in 5 Steps

The most reliable method in production: nvm-windows.

# 1. Download and run nvm-setup.exe from GitHub
# 2. Verify the installation
nvm version

# 3. Install the LTS version
nvm install lts

# 4. Activate the installed version (e.g. 24.16.0)
nvm use 24.16.0

# 5. Verify Node.js and npm
node -v && npm -v

Then, deploy your app with PM2 so that it survives server restarts.


Prerequisites

Before you begin, make sure you have:

  • Windows Server 2019 or 2022 with administrator access

  • Active RDP connection

  • Minimum 1 GB of RAM (2 GB recommended for production)

  • Open ports: 3000 (dev), 80/443 (prod)

  • PowerShell 5.1+: included by default on Windows Server 2019/2022


Which installation method to choose?

There are three options to install Node.js on Windows Server. Here’s the comparison:

Method

Use Case

Advantages

Disadvantages

nvm-windows

Developers, multi-project production

Multi-version management, quick switching

Installation slightly longer

MSI Installer

Single version, quick start

Simple, familiar

Hard to change version

winget

Modern Windows Server 2022

Native CLI, fast

Less control over versions

Recommendation: nvm-windows. On a Windows VPS in production, you will sooner or later need to juggle between Node 20 LTS and Node 22. It’s best to plan for this from the start.


Method 1: Install Node.js with nvm-windows (recommended)

nvm-windows is the Node.js version manager for Windows. It is a separate project from nvm (which only works on Linux/macOS).

Step 1: Download nvm-windows

Go to the GitHub releases page: 👉 https://github.com/coreybutler/nvm-windows/releases

Download nvm-setup.exe (latest stable version, currently v1.2.x).

Step 2: Run the installer

Run nvm-setup.exe as Administrator. Keep the default installation paths.

Step 3: Verify the installation

Open a new PowerShell terminal (important: close the old one):

nvm version

Expected result: 1.2.x or higher.

Step 4: Install Node.js LTS

nvm install lts

This command automatically downloads the latest LTS version (currently 24.16.0).

Step 5: Activate the version

nvm use 24.16.0

Replace 24.16.0 with the version displayed after nvm install lts.

Step 6: Verify Node.js and npm

node -v && npm -v

Expected result:

v24.16.0
10.x.x

Step 7: Install and manage multiple versions

# Install Node 20 LTS and Node 22
nvm install 20.19.0
nvm install 22.14.0

# Switch to Node 22
nvm use 22.14.0

# List all installed versions
nvm list

Method 2: Install Node.js with the MSI installer

The most straightforward method for a single version. Ideal if you only have one project and do not plan to change versions.

Steps

  1. Go to https://nodejs.org/en/download

  2. Download the Windows Installer (.msi): choose the LTS version

  3. Run the installer and check "Add to PATH" during installation

  4. Verify in PowerShell:

node -v && npm -v

Main limitation: to change versions, you must manually uninstall and then reinstall. Not convenient in production.


Method 3: Install Node.js with winget

Available on Windows Server 2022 with App Installer installed. One command is enough:

winget install OpenJS.NodeJS.LTS

Verification:

node -v

Note: winget installs a fixed version. To change versions, go back through winget upgrade or switch to nvm-windows.


Deploy a Node.js application on Windows Server

We will create a minimal Express.js app to validate the end-to-end installation.

Step 1: Create the project folder

mkdir C:\apps\monapp
cd C:\apps\monapp

Step 2: Initialize npm

npm init -y

Step 3: Install Express

npm install express

Step 4: Create the server.js file

New-Item server.js
notepad server.js

Paste this code into Notepad:

const express = require('express');
const app = express();
const PORT = 3000;

app.get('/', (req, res) => {
  res.send('Hello from OuiHeberg VPS!');
});

app.listen(PORT, () => {
  console.log(`Server started on port ${PORT}`);
});

Save and close Notepad.

Step 5: Test the application

node server.js

Open a browser on your VPS and go to http://localhost:3000. You should see:

Hello from OuiHeberg VPS!

Ctrl+C to stop the server. Now let's move on to PM2 to keep it online.


Keep Node.js online with PM2

This is the part that most guides forget. Without PM2, your app stops as soon as you close PowerShell or the server restarts.

Step 1: Install PM2

npm install -g pm2

Step 2: Start the application with PM2

pm2 start C:\apps\monapp\server.js --name "monapp"

Step 3: Configure automatic startup

pm2 startup

PM2 generates a command to copy-paste and execute. Run it. Then save the current state:

pm2 save

From now on, your app will automatically restart after each reboot of the VPS.

Essential PM2 commands

Command

Action

pm2 list

List all processes

pm2 logs monapp

Display logs in real-time

pm2 restart monapp

Restart the application

pm2 stop monapp

Stop the application

pm2 monit

Real-time monitoring (CPU, RAM)

pm2 delete monapp

Remove the process from PM2

PM2 is free and open source (MIT license). It is the de facto standard for managing Node.js processes in production.


Configure the Windows Firewall for Node.js

Without this step, your app is inaccessible from the outside. Open PowerShell as Administrator:

# Open port 3000 (development)
New-NetFirewallRule -DisplayName "Node.js Dev" -Direction Inbound -Protocol TCP -LocalPort 3000 -Action Allow

# Open port 80 (production HTTP)
New-NetFirewallRule -DisplayName "Node.js HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow

# Open port 443 (production HTTPS)
New-NetFirewallRule -DisplayName "Node.js HTTPS" -Direction Inbound -Protocol TCP -LocalPort 443 -Action Allow

Check that the rules are active:

Get-NetFirewallRule -DisplayName "Node.js*" | Select Name, Enabled

Expected result: Enabled = True for each rule.


Manage multiple versions of Node.js with nvm-windows

This is one of the great advantages of nvm-windows: test your app on Node 20 LTS before migrating to Node 22, without uninstalling anything.

# List installed versions
nvm list

# Install a specific version
nvm install 20.19.0

# Switch to that version
nvm use 20.19.0

# Uninstall an outdated version
nvm uninstall 18.20.0

Typical use case: your app runs on Node 20 in production. You install Node 22 with nvm install 22.14.0, test with nvm use 22.14.0, and if all goes well, you update production.


Update Node.js on Windows Server

With nvm-windows, the update is clean and reversible:

# Install the new LTS version
nvm install lts

# Activate the new version (e.g. 24.16.0)
nvm use 24.16.0

# Remove the old version if everything works
nvm uninstall 22.14.0

Important: always test your application's compatibility before switching to production. Some npm packages may have dependencies tied to a major version of Node.


Troubleshooting: 6 common errors

1. 'node' is not recognized as a command

The PATH is not configured. Close and reopen PowerShell, then rerun nvm use [version].

2. nvm is not recognized

nvm-windows is not properly installed. Reinstall nvm-setup.exe as Administrator.

3. EACCES: permission denied during a npm install -g

Run PowerShell as Administrator before executing the command.

4. Port 3000 already in use

A process is already using the port. Identify it and stop it:

netstat -ano | findstr :3000
taskkill /PID [PID] /F

Replace [PID] with the process number displayed.

5. PM2 does not restart after a reboot

The command generated by pm2 startup was not executed. Rerun pm2 startup, copy-paste the displayed command, then do pm2 save.

6. node_modules missing after an nvm version switch

Normal: each Node version has its own global modules. Rerun npm install in your project folder after each nvm use.


FAQ

Which version of Node.js to install on Windows Server?

Always the LTS (Long Term Support) version. It receives security patches for 3 years and is designed for stability in production. As of May 2026, the active LTS is Node.js 24.x.

Does Node.js work on Windows Server 2019 and 2022?

Yes, both are fully supported. Node.js publishes native Windows binaries for each LTS version. nvm-windows works on both.

What is the difference between nvm-windows and nvm?

nvm (nvm-sh) is designed for Linux and macOS only: it does not work on Windows. nvm-windows is a separate project, developed by Corey Butler, that serves the same purpose on Windows.

How to see which version of Node.js is active?

node -v
# or
nvm list

The active version is marked with an asterisk * in nvm list.

Is PM2 free?

Yes. PM2 Runtime is open source under the MIT license. There is a paid version (PM2 Plus) for advanced monitoring, but it is not necessary for most projects.

Can multiple Node.js apps run on the same VPS?

Yes, with PM2: each app listens on a different port (3000, 3001, 3002…). To expose all of this on port 80/443, use a reverse proxy like Nginx or IIS in front.


Useful sources