The error, verbatim
Jump to the fix ↓'vite' is not recognized as an internal or external command,
operable program or batch file.
# PowerShell words the same thing differently:
vite : The term 'vite' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
The fix that worked
Run it through npm instead:
npm run dev
npx vite --versionNot it? Every cause, tested ↓Tested on
- OS
- Windows 11 Pro 26200
- Node
- 24.14.0
- npm
- 11.9.0; 12.2.2 (November 8)
- Example tool
- vite 8.3.0
- Shells
- cmd.exe, PowerShell 5.1; PowerShell 7 on the November 2 re-run
✓ Last re-run on GitHub Actions · see the run · all repros
Contents
The name in the message changes — vite, react-scripts, ts-node, nodemon, tsc, eslint — the cause doesn’t. Windows is telling you the truth: that word isn’t a program it can find. The package may well be installed.
Tell the five causes apart first
Run this in the folder you’re in:
npm ls vite| What you see | Cause | Go to |
|---|---|---|
| The package, with a version | It’s installed, you just called it wrong | 1 |
(empty) or “not found” |
It isn’t installed here | 2 |
The package, but npm run still fails |
The shim is missing from node_modules\.bin |
3 |
You installed it with -g |
The global folder isn’t on your PATH | 4 |
The word is NODE_ENV (or another NAME=value) |
A Linux-style variable in an npm script | 5 |
1. Installed locally, called directly
This is the common one. The tool is in node_modules, and typing its name still fails:
C:\project> vite --version
'vite' is not recognized as an internal or external command,
operable program or batch file.
Run it through npm instead, and it works with no other change:
npm run dev # if package.json has a "dev" script
npx vite --version # any local binary, no script neededWhy that works is worth seeing, because it explains every other case. npm puts the project’s binaries at the front of PATH while a script runs:
# inside npm run
C:\project\node_modules\.bin
# the same machine, outside npm
C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64
Your shell never had that folder. npm adds it, runs the command, and removes it again. Installing a package locally does not put anything on your PATH, and it was never supposed to.
2. Not installed in this folder
A fresh clone, a wiped node_modules, or the wrong directory. The message arrives from inside the script, which makes it look like npm’s fault:
> notrec@1.0.0 dev
> vite --version
'vite' is not recognized as an internal or external command,
operable program or batch file.
npm installIf npm install itself failed earlier — a peer conflict, a network drop, a full disk — the packages in package.json never arrived, and this is how you find out. Read the install output rather than re-running it blindly.
3. Installed, but the shim is gone
Rarer, and confusing, because npm ls shows the package. Windows needs a launcher file next to the package:
node_modules\.bin\vite <- for Git Bash
node_modules\.bin\vite.cmd <- for cmd.exe
node_modules\.bin\vite.ps1 <- for PowerShell
Delete those and the failure returns even though the package is still installed. It happens after a half-finished install, an antivirus quarantine, or copying a project folder without node_modules.
npm install vite --forceOr delete node_modules and install again. Reinstalling the one package recreates its shims.
4. Installed globally, PATH doesn’t know
Find where global binaries land, then check that exact folder is on your PATH:
npm prefix -gOn Windows that’s usually C:\Users\<your name>\AppData\Roaming\npm. Proof this is all it is: I installed a tool to a folder that isn’t on PATH, and got the identical error — then ran the same binary by full path and it worked:
C:\project> cowsay hi
'cowsay' is not recognized as an internal or external command,
operable program or batch file.
C:\project> C:\project\gtemp\cowsay.cmd hi
____
< hi >
----Two fixes, in order of preference:
- Don’t install it globally.
npx <tool>runs it without touching PATH, and a project dependency pins the version your project needs. - Add the folder to PATH: Start → “Edit the system environment variables” → Environment Variables → select
Path→ New → paste thenpm prefix -gfolder → OK. Then open a new terminal, because an open one keeps its old copy of PATH.
5. ‘NODE_ENV’ is not recognized: a Linux-style variable in a script
When the word in the message is NODE_ENV (or any NAME), nothing is missing. The script in package.json sets a variable the way Linux and macOS shells do:
"dev": "NODE_ENV=development node --watch --import remix/node-tsx server.ts"
npm runs scripts with cmd.exe on Windows, which reads NODE_ENV=development as the name of a program:
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
This is how a fresh Remix 3 project behaves on Windows today: npm run dev and npm test both stop here. The same project ran unchanged on Linux (details).
Install cross-env and put it in front of the variable:
npm i -D cross-env"dev": "cross-env NODE_ENV=development node --watch --import remix/node-tsx server.ts"The neighbour: it’s found, but PowerShell won’t run it
Once the global folder is on your PATH, Windows PowerShell 5.1 can still refuse the tool with a different message. npm installs three shims for every command (cowsay, cowsay.cmd and cowsay.ps1), and PowerShell prefers the .ps1 one, which is a script. On a PC where scripts are disabled, the default on many Windows installs:

File C:\npm\prefix\cowsay.ps1 cannot be loaded because running scripts is disabled on this system.
Call the .cmd shim instead, which isn’t a script and needs no policy change: cowsay.cmd hi, vite.cmd, tsc.cmd. Or allow local scripts for your own user only:
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedReading the message in your shell
Each shell words it differently, which matters when searching:
cmd.exe: 'vite' is not recognized as an internal or external command,
operable program or batch file.
PowerShell 5.1: vite : The term 'vite' is not recognized as the name of a cmdlet,
function, script file, or operable program.
PowerShell 7: The term 'vite' is not recognized as a name of a cmdlet,
function, script file, or executable program.
Git Bash: bash: vite: command not found
Different text, same meaning: the shell searched PATH and found nothing.
On Linux, macOS, in CI or in Docker the causes are different (production installs that skip devDependencies, a lost execute bit, a bind mount): sh: vite: command not found.
What didn’t work
Test runs
One Windows 11 project with vite@8.3.0 as a dev dependency, on Node 24.14.0 and npm 11.9.0. Each cause was produced on purpose: calling the binary directly, renaming node_modules away, deleting the .bin shims, and installing a package to a prefix that isn’t on PATH. Every block above is the real terminal output from cmd.exe or PowerShell, including the PATH comparison from inside and outside an npm script.
November 2, 2026: all five causes were re-run on GitHub Actions windows-latest (Windows Server 2025, Node 24.22.1, npm 11.19.1, vite 8.3.5), in cmd.exe, Windows PowerShell 5.1 and PowerShell 7. Every result matched: the bare vite failed while npx and npm run worked, renaming node_modules and deleting the three shims both brought the error back, npm install vite --force restored the shims, a global install outside PATH failed until called by full path, and NODE_ENV=development in a script failed until cross-env 10.1.0 was put in front. Cause 5 used a one-line script, not the Remix project. The script and output are public.
November 8, 2026: the five causes again on npm 12.2.2 with vite 8.3.6, all unchanged, plus the execution-policy case above with Windows PowerShell 5.1 on the same runner (run 42510192602).
— N.K., end of entry No.016