6 common reasons deployments fail (and exactly how to fix each one). Get your app live in 10 minutes.
Most Common Fix:
Build Command: npm run build
Publish Directory: dist (or build for React)
Missing env vars in Netlify dashboard
Works for Vercel too • Fixes 90% of deploy failures • Step-by-step solutions
All fixable
Each error has a specific solution. Find your error message and follow the fix.
The Error: Netlify can't find your build command or it's failing during execution.
The Fix:
npm run build, npm build, or vite builddist (Vite) or build (React)Check your package.json:
"scripts": {
"build": "vite build",
...
}
Result: Build command matches your actual build script.
The Error: Dependencies weren't installed correctly or package.json wasn't committed.
The Fix:
npm install and commit the fresh lockfilePro Tip: Always commit lockfiles to ensure consistent installs between local and production.
The Error: The build completed but Netlify can't find the output files.
The Fix:
npm run builddist or build)dist ≠ Dist ≠ DISTdist (Vite), build (React), public (some setups)Vite apps: Check vite.config.js for build.outDir setting
The Error: Your app needs environment variables but Netlify doesn't have them.
The Fix:
VITE_VITE_SUPABASE_URL, not just SUPABASE_URLCritical: Environment variables don't auto-update. You must redeploy after changing them.
The Error: Your code requires a different Node version than Netlify uses by default.
The Fix:
node -vNODE_VERSION = 18.17.0 (or your version)Alternative: Create a .nvmrc file in your repo with just the version number (e.g., 18.17.0)
The Error: Refreshing a page or visiting a direct URL shows 404. This is a single-page app (SPA) routing issue.
The Fix:
_redirects in your public folder/* /index.html 200Alternative: Create netlify.toml in root:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Result: All routes serve index.html, letting your React/Vue router handle the path.
| Framework | Build Command | Publish Directory |
|---|---|---|
| Vite (Vue/React) | npm run build |
dist |
| Create React App | npm run build |
build |
| Next.js | next build |
out |
| SvelteKit | npm run build |
build |
| Astro | npm run build |
dist |
Check your package.json scripts if unsure. The build command should match your "build" script.
Before contacting support, verify these 8 items.
Some deployment issues require deeper investigation: custom build processes, edge functions, monorepos, or complex dependency trees. Get expert help to diagnose and fix.
Includes: Build configuration review, dependency audit, environment variable check, deployment pipeline setup, and working fix within 48 hours.