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.
Tested on
- OS
- Windows 11 Pro 26200
- Node
- 24.14.0
- npm
- 11.9.0
- Example tool
- vite 8.3.0
- Shells
- cmd.exe and PowerShell 5.1
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 four 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 |
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.
Reading the message in your shell
The two shells word it differently, which matters when searching:
cmd.exe: 'vite' is not recognized as an internal or external command,
operable program or batch file.
PowerShell: vite : The term 'vite' is not recognized as the name of a cmdlet,
function, script file, or operable program.
Git Bash: bash: vite: command not found
Different text, same meaning: the shell searched PATH and found nothing.
What didn’t work
How this was tested
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.
— N.K., end of entry No.017