Fix Nixpacks "vite: not found" build failure on Coolify
Error: sh: 1: vite: not found (exit code 127) — also seen as "tsc: not found", "next: not found", "react-scripts: not found" during npm run build
Your build command needs a tool (vite, tsc, next, react-scripts) that lives in devDependencies, but only production dependencies got installed, so the binary isn't on PATH and npm run build exits 127.
Coolify's Nixpacks Node build can run the install step with devDependencies omitted (the build log shows npm ci --omit=dev), and/or NODE_ENV=production leads npm to skip devDependencies. Build tools like vite/tsc/react-scripts normally sit in devDependencies, so npm run build can't find their binary and exits 127. Nixpacks' own Node provider is meant to set NPM_CONFIG_PRODUCTION=false to keep dev deps installed; when that doesn't take effect on Coolify, you set it yourself.
The fix
Quickest reliable fix: force dev dependencies to install during the build. In Coolify open the app's Environment Variables, add NPM_CONFIG_PRODUCTION=false, and tick its "Build Variable" checkbox so it applies during the build phase (not just runtime).
NPM_CONFIG_PRODUCTION=false # Build Variable = ONIf your build runs with NODE_ENV=production (which also makes npm skip devDependencies), either remove that build-time variable or keep NPM_CONFIG_PRODUCTION=false alongside it so dev deps still install.
Alternative permanent fix: move the build-only tools the build genuinely needs from devDependencies into dependencies in package.json, then commit and push.
npm install vite # or tsc / next / react-scripts, etc.If you want full control of the build, add a Dockerfile that installs everything, builds, then prunes, and set Build Pack = Dockerfile in Coolify.
RUN npm ci # installs dev + prod RUN npm run build # vite is now on PATH RUN npm prune --omit=devRedeploy.
Verify it worked
The build log shows the build script running to completion (e.g. "vite vX.X.X building for production… built in Xs") with no "not found" / exit code 127 line.
Related Coolify errors
- Nixpacks was unable to generate a build plan for this app. / No setup or build phase could be determined (could not determine how to build the app)
- NET::ERR_CERT_AUTHORITY_INVALID
- TRAEFIK DEFAULT CERT / self-signed certificate
- www.domain.com cert error but apex works