Skip to content

Multiple Node.js versions on Windows: absolute paths beat nvm

Verified 1 min read

Use nvm-windows for the CLI, but pin each service to an absolute node.exe so a global switch cannot break production.

Tested onStandard / Datacenter · Build 26100.33650 · x64
E1
Build
26100.33650
Edition
Standard / Datacenter
Architecture
x64
Support
Documentation (E1)
Evidence
E1Official documentation
Verified
2026-10-29
Page type
Method

nvm-windows switches a global symlink (C:\Program Files\nodejs). That is fine for your shell, dangerous for services.

For multiple apps:

  1. Install each Node version in its own directory (C:\node\20, C:\node\22).
  2. Pin the service/script to the absolute node.exe.
  3. Use the matching npm.cmd from that directory.
  4. Keep node_modules per app; do not share global packages.
Terminal window
nvm list
nvm install 22.14.0
nvm use 22.14.0
where.exe node
node --version

After nvm use, where node points at the active symlink. That is convenient for development; it is not a production selector.

C:\node\20\node.exe
C:\node\22\node.exe
C:\apps\api-a\server.js
C:\apps\api-b\server.js

Run:

Terminal window
& C:\node\20\node.exe C:\apps\api-a\server.js
& C:\node\22\node.exe C:\apps\api-b\server.js

The service wrapper must use the same absolute path. A service created with node resolves through PATH at start time; after an nvm switch it can silently use the wrong version.

Terminal window
cd C:\apps\api-a
& C:\node\20\npm.cmd ci --omit=dev

Use npm ci with a lockfile for repeatable installs. Do not npm install -g app dependencies; global packages are shared and versionless.

Terminal window
& C:\node\20\node.exe --version
& C:\node\20\npm.cmd --version
Get-CimInstance Win32_Process -Filter "Name='node.exe'" |
Select-Object ProcessId, ExecutablePath, CommandLine

ExecutablePath should show the pinned version, not the nvm symlink.

  1. Install the new Node beside the old.
  2. Run the app’s test suite with the new absolute node.exe.
  3. Update the service wrapper path.
  4. Restart one service; watch logs and metrics.
  5. Keep the old directory until rollback is no longer needed.

E1. The lab did not install Node or nvm-windows; the procedure is the production selector pattern, not a reproduced result.

Sources