Windows · PowerShell · .nvmrc

Make .nvmrc work on Windows.

On Windows, nvm switches Node for every project at once. nvmx reads .nvmrc and uses the right version for each command instead — without changing anything else.

Plain PowerShell · about 11 KB · no exe, no background app

PowerShell
PS app-a> type .nvmrc
18.20.4
PS app-a> node -v
v18.20.4   # from .nvmrc, this command only

PS app-b> node -v
v22.3.0    # no .nvmrc here → your default

The problem

nvm-windows isn't the same as nvm on Mac or Linux. It switches Node by changing one shared link that every folder uses. So if you run nvm use 20 in one project, all your other projects switch to 20 too. There is no per-project version, and .nvmrc does nothing on its own.

nvmx fixes this. It wraps node, npm, and npx so each command reads .nvmrc and runs that version — only for that one command. Nothing else changes.

How it works

Each time you run node, npm, or npx:

  1. 1

    Find .nvmrc

    Looks in the current folder and the folders above it.

  2. 2

    Run that version

    Runs the matching installed Node directly. It never runs nvm use.

  3. 3

    Put it back

    Switches back as soon as the command ends. Other folders and terminals stay the same.

Scripts work too

Anything started by node, npm, or npx uses the same version. So npm scripts just work:

package.json
"scripts": {
  "dev": "nodemon src/index.ts"
}
terminal
npm run dev
# npm → .nvmrc Node → nodemon → index.ts
# all on v18.20.4

If you type a tool like nodemon by itself, it uses your default Node. Only node, npm, and npx are wrapped. Run it with npm run or npx and it follows .nvmrc.

What you get

One version per command

Each command picks its own version. Your default stays the default everywhere else.

No global changes

It never runs nvm use, so nothing on your system changes. Other terminals don't move.

Fast and simple

Keep typing node and npm like normal. It adds only a few milliseconds.

Clear errors

Tells you plainly if a version is missing, nvm isn't installed, or the version is an unsupported alias.

Easy install

Double-click install.cmd. It sets everything up for you.

Easy uninstall

Run Uninstall-Nvmx or double-click uninstall.cmd. Nothing is left behind.

Install

Clone the repo:

> git clone https://github.com/UsmanDrigrocha/nvmx
> cd nvmx

Then double-click install.cmd — or run:

> powershell -ExecutionPolicy Bypass -File .\Install.ps1

Open a new terminal and check it:

> nvmx-status

To remove it, run Uninstall-Nvmx in any terminal, or double-click uninstall.cmd.

You need nvm-windows with NVM_HOME set, and your Node versions installed (nvm install 20.19.0). Works in PowerShell 5.1 or 7+.