Bolt.new deploy failed (or broken) on Netlify: read the log and fix the real error
By AI App Medic · Updated · Bolt · Netlify · Deploy
Bolt.new runs your app inside a Node environment in the browser (StackBlitz WebContainers). Netlify builds the same code on a Linux build image. Most "works in Bolt, fails on Netlify" problems come from that difference. The fix starts with the deploy log, specifically the first error, not the last line.
Find the real error
- Netlify > your site > Deploys > click the failed deploy.
- Scroll up from the bottom until you find the first line in red. Lines after it are usually consequences.
- Before changing anything, run
npm run buildin Bolt's terminal. If it fails there too, fix that first.
Common errors and fixes
| Log says | Cause | Fix |
|---|---|---|
Module not found: Can't resolve './components/Header' | File missing, or letter case differs (header.tsx vs Header). Linux is case-sensitive. | Make the import match the file name exactly. |
TypeScript errors like TS2322, TS2345 | Your build script runs the type checker (for example tsc && vite build). | Fix the listed type errors one by one. Removing the type check hides bugs. |
ERESOLVE unable to resolve dependency tree | Conflicting peer dependency versions. | Align the package versions. As a temporary workaround set NPM_FLAGS=--legacy-peer-deps in Netlify's environment variables. |
| Syntax or engine errors in Node itself | Different Node version. | Pin it: add an .nvmrc file containing e.g. 20, or set NODE_VERSION in Netlify. |
Deploy directory 'dist' does not exist | Publish directory and build output do not match. | Use build command npm run build and publish directory dist for Vite. |
| Build succeeds, live page blank | Missing VITE_ env vars at build time. | Add them in Netlify and redeploy. See blank page fixes. |
| Build succeeds, refresh gives 404 | No SPA fallback. | Add public/_redirects with /* /index.html 200. See 404 on refresh. |
A clean netlify.toml for a Bolt (Vite) app
[build]
command = "npm run build"
publish = "dist"
[build.environment]
NODE_VERSION = "20"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
When the live site loads but features fail
- Login fails or redirects to the wrong place: add your Netlify URL and custom domain to Supabase Auth's URL configuration. See auth redirect fixes.
- API calls fail with CORS errors: a backend or third-party API only allowed Bolt's preview domain. Add your production domain to its allowed origins.
- Dragged the project folder into Netlify Drop: Drop does not run a build. Build first and drop only the
distfolder.
Once it is live, run a free health scan to check for exposed keys and missing security headers before you share the link. If the deploy is green but the app is blank or prints undefined for your Supabase URL, the usual cause is missing env values: Bolt works in preview, breaks on Netlify.
FAQ
Where do I find the error for a failed Bolt deploy?
In Netlify open the site, go to Deploys, click the failed deploy and scroll to the first red error in the log. Inside Bolt, the publish output panel shows the same build output.
Why does it build in Bolt but fail on Netlify?
Bolt runs your project in a browser-based Node environment. Netlify builds on Linux with its own Node version, so version differences, case-sensitive file names and missing env vars show up only there.
The build succeeded but the site is blank. Now what?
That is usually missing VITE_ environment variables or the wrong publish directory. See our blank page guide.
Related guides
- Bolt.new works in preview but breaks on Netlify: missing environment variables
- Netlify build fails with "Secrets scanning found secrets in build": tell a public key from a real leak
- Lovable or Bolt app returns 404 on refresh: the SPA fallback for every host
- TypeError: Failed to fetch dynamically imported module, after a Vite deploy
- Lovable app shows a blank white page after deploy: causes and fixes