Skip to content
Nilay Kabariya

Entry No.017·Fixes··4 min read

Fix: 'vite' is not recognized as an internal or external command

Windows says the command doesn't exist, but it's right there in node_modules. The four causes, how to tell them apart in one command, and what each one needs.

by Nilay#npm#windows#nodeFIXED

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.
✓ Reproduced on Windows 11 Pro

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
  1. Tell the four causes apart first01
  2. 1. Installed locally, called directly02
  3. 2. Not installed in this folder03
  4. 3. Installed, but the shim is gone04
  5. 4. Installed globally, PATH doesn’t know05
  6. Reading the message in your shell06
  7. What didn’t work07
  8. How this was tested08

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 needed

Why 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 install

If 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 --force

Or 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 -g

On 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 the npm prefix -g folder → 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

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.042

    Fix: "Could not locate the bindings file" in sqlite3

    sqlite3 or better-sqlite3 installed fine, then can't find its .node file. Four causes reproduced, how the Tried: paths tell them apart, and the fix for each.

    > Error: Could not locate the bindings file. Tried:

    FIXED3 min
  2. No.036

    Fix: npm error Missing script: "dev" (and "start")

    npm can't find the script you asked for. Six real causes, from a stray package.json up the tree to monorepos, and two commands that show which one you have.

    > npm error Missing script: "dev"

    FIXED5 min
  3. No.039

    npm 12 breaking changes, tested: what actually breaks

    The headline change, install scripts blocked by default, broke puppeteer, cypress, sqlite3 and Claude Code's npm package, and silently skipped lefthook's git hooks. esbuild, bcrypt, sharp and better-sqlite3 kept working. Every install reported success, and the only sign was a warning after the summary.

    TESTED5 min

Post card · Newsletter

Get the next fix in your inbox.

One short email when a new entry is published. No spam, never shared, and you can leave any time.

— Nilay

or follow by RSSor on X

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text