First published on the VMHeaven blog: vite: command not found? Run the local binary the right way. The canonical points there; the full guide covers npm/pnpm/yarn, CI and global installs.
Short answer: Vite is a local devDependency, not a global command. vite: command not found (or sh: vite: command not found) almost always means you ran plain vite in a shell where the project's local binary (node_modules/.bin) is not on PATH.
The fix
Install dependencies, then run Vite through the tool that knows about node_modules/.bin:
npm install npm run dev # uses the "dev": "vite" script in package.json Or run the local binary directly, without a script:
npx vite pnpm and yarn have their own:
pnpm install && pnpm dev # or: pnpm exec vite yarn install && yarn dev # or: yarn vite Why plain vite fails
-
npm run devworks butvitedoes not - that is expected. npm scripts putnode_modules/.binon PATH; your interactive shell does not. Use the script ornpx vite. - In CI / Docker - run
npm cibefore the build step and callnpx vite build(ornpm run build), never barevite. - You really want it global -
npm install -g viteworks, but pinning Vite per project is safer; versions differ between projects.
Full guide
Monorepos, vite: not found in Docker builds, Windows, and the pnpm .bin quirks are in the complete version:
vite: command not found - the complete fix
Need a box to build on? A Node-ready VPS spins up in a minute.

![Physical AI Hardware Software Co Design — Ch.03: Actuator AI Co Design [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxtsewr6luvpznqila61f.png)
