Multiple Node.js versions on Windows: absolute paths beat nvm
Use nvm-windows for the CLI, but pin each service to an absolute node.exe so a global switch cannot break production.
- Build
- 26100.33650
- Edition
- Standard / Datacenter
- Architecture
- x64
- Support
- Documentation (E1)
- Evidence
- E1Official documentation
- Verified
- 2026-10-29
- Page type
- Method
The short answer
Section titled “The short answer”nvm-windows switches a global symlink (C:\Program Files\nodejs). That is fine for your shell, dangerous for services.
For multiple apps:
- Install each Node version in its own directory (
C:\node\20,C:\node\22). - Pin the service/script to the absolute
node.exe. - Use the matching
npm.cmdfrom that directory. - Keep
node_modulesper app; do not share global packages.
CLI layout
Section titled “CLI layout”nvm listnvm install 22.14.0nvm use 22.14.0where.exe nodenode --versionAfter nvm use, where node points at the active symlink. That is convenient for development; it is not a production selector.
Per-app layout
Section titled “Per-app layout”C:\node\20\node.exeC:\node\22\node.exeC:\apps\api-a\server.jsC:\apps\api-b\server.jsRun:
& C:\node\20\node.exe C:\apps\api-a\server.js& C:\node\22\node.exe C:\apps\api-b\server.jsThe 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.
Dependencies
Section titled “Dependencies”cd C:\apps\api-a& C:\node\20\npm.cmd ci --omit=devUse npm ci with a lockfile for repeatable installs. Do not npm install -g app dependencies; global packages are shared and versionless.
Verify
Section titled “Verify”& C:\node\20\node.exe --version& C:\node\20\npm.cmd --versionGet-CimInstance Win32_Process -Filter "Name='node.exe'" | Select-Object ProcessId, ExecutablePath, CommandLineExecutablePath should show the pinned version, not the nvm symlink.
Upgrade path
Section titled “Upgrade path”- Install the new Node beside the old.
- Run the app’s test suite with the new absolute
node.exe. - Update the service wrapper path.
- Restart one service; watch logs and metrics.
- Keep the old directory until rollback is no longer needed.
Lab boundary
Section titled “Lab boundary”E1. The lab did not install Node or nvm-windows; the procedure is the production selector pattern, not a reproduced result.