Deployment Fix

Bolt.new Deploy
Failed on Netlify?

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

See Fix Guide Get Expert Help ($299)

Works for Vercel too • Fixes 90% of deploy failures • Step-by-step solutions

Deploy Failures

"Build failed"
"Module not found"
"Build script failed"
"Page not found"

All fixable

6 Common Failures

Fix Netlify Deployment Errors

Each error has a specific solution. Find your error message and follow the fix.

1

"Build command failed" or "npm run build exited with error"

The Error: Netlify can't find your build command or it's failing during execution.

The Fix:

  1. Go to Netlify Dashboard → Your Site → Site Settings → Build & Deploy
  2. Check "Build command" - should match your package.json scripts
  3. Common values: npm run build, npm build, or vite build
  4. Check "Publish directory" - usually dist (Vite) or build (React)
  5. Trigger a new deploy after changing settings

Check your package.json:

"scripts": {
  "build": "vite build",
  ...
}

Result: Build command matches your actual build script.

2

"Module not found" or "Cannot resolve dependency"

The Error: Dependencies weren't installed correctly or package.json wasn't committed.

The Fix:

  1. Verify package.json is in your GitHub repo root
  2. Check that package-lock.json or yarn.lock is committed
  3. Go to Netlify → Deploys → Trigger deploy → Clear cache and retry
  4. If still failing, delete node_modules and package-lock.json locally
  5. Run npm install and commit the fresh lockfile

Pro Tip: Always commit lockfiles to ensure consistent installs between local and production.

3

"Publish directory doesn't exist" or "Site not found"

The Error: The build completed but Netlify can't find the output files.

The Fix:

  1. Check your build output locally: run npm run build
  2. Look for the output folder (usually dist or build)
  3. In Netlify settings, set "Publish directory" to match exactly
  4. Case matters: distDistDIST
  5. Common folders: dist (Vite), build (React), public (some setups)

Vite apps: Check vite.config.js for build.outDir setting

4

"Environment variable not found" or "process is not defined"

The Error: Your app needs environment variables but Netlify doesn't have them.

The Fix:

  1. Go to Netlify Dashboard → Site Settings → Environment Variables
  2. Add all variables from your local .env file
  3. For Vite apps, variables must start with VITE_
  4. Example: VITE_SUPABASE_URL, not just SUPABASE_URL
  5. Trigger new deploy after adding variables

Critical: Environment variables don't auto-update. You must redeploy after changing them.

5

"Node.js version mismatch" or "Unsupported engine"

The Error: Your code requires a different Node version than Netlify uses by default.

The Fix:

  1. Check your local Node version: node -v
  2. Go to Netlify → Environment Variables
  3. Add variable: NODE_VERSION = 18.17.0 (or your version)
  4. Trigger new deploy

Alternative: Create a .nvmrc file in your repo with just the version number (e.g., 18.17.0)

6

"Page not found" on refresh (SPA routing issue)

The Error: Refreshing a page or visiting a direct URL shows 404. This is a single-page app (SPA) routing issue.

The Fix:

  1. Create a file named _redirects in your public folder
  2. Add this line: /* /index.html 200
  3. Commit and push to trigger redeploy

Alternative: 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.

Quick Reference

Netlify Build Settings Cheat Sheet

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.

Deployment Checklist

Before contacting support, verify these 8 items.

Still Can't Deploy?

Some deployment issues require deeper investigation: custom build processes, edge functions, monorepos, or complex dependency trees. Get expert help to diagnose and fix.

Book Deploy Audit ($299) Get Free Fix Guide

Includes: Build configuration review, dependency audit, environment variable check, deployment pipeline setup, and working fix within 48 hours.