How to troubleshoot deployment failures on Netlify
First verify your build succeeds locally, then use Netlify's AI 'Why did it fail?' feature on the deploy summary page for instant diagnosis. Review logs for errors like exit status 128, adjust build settings, and retry without cache if needed.
Prerequisites
- Build works locally
- Netlify Owner or Developer access
- Git repository linked
- Basic terminal knowledge
Step-by-Step Instructions
Verify build locally
npm run build or yarn build, checking your package.json for the exact script. Ensure it completes without errors and outputs files to the expected directory like dist or build. This isolates if the issue is Netlify-specific.Navigate to failed deploy
app.netlify.com, select your site, go to the Deploys tab, and click the failed deploy row to open the deploy summary page.Use Why did it fail? AI
Review deploy logs
Exit status 128 (repo permissions), TypeScript errors like 'user id should be a string not a number', or dependency failures. Scroll to the timestamped failure point.Check build settings
/client), Build command (e.g. npm ci && npm run build), and Publish directory (e.g. dist/public). Save and trigger new deploy.Retry without cache
~/.npm and node modules. Match Node version in netlify.toml: [build]
environment = { NODE_VERSION = "20.11.0" } Commit/push or use Trigger deploy.Inspect files with Deploy File Explorer
index.html, check for missing assets causing 404s, or download ZIP/files to verify publish directory.Relink repository
Handle large files
Match dependency versions
Common Issues & Troubleshooting
Exit status 128
Repo clone permission issue; relink repository and check Git webhook settings.
Package version mismatches
Match local deps to Netlify, use npm ci, set NODE_VERSION in netlify.toml.
Missing files or 404s
Verify publish directory in build settings; use Deploy File Explorer.
Large files over 10 MB
Host externally; avoid embedding large media.
TypeScript/dependency errors
Review logs for specifics like type mismatches; use AI diagnosis.