Guide Deploys

Lovable or Bolt app won't deploy: common fixes

Short answer

It works in the editor. You hit publish, or push to Vercel or Netlify, and something breaks. The build fails, the page is blank, login bounces you back, or every page except the home page shows a 404. Most of these come down to a short list of causes. Here they are, in the order we'd check them.

1. The build itself fails

The preview in Lovable or Bolt is more forgiving than a production build. A production build runs npm run build, and it stops on things the preview lets slide, like a type error or a missing import.

What to do:

  • Read the error. In Lovable, a failed publish shows a "Publishing failed" message or "Build errors need fixing", with a Try to fix button. Use it, or describe the error in chat. (Lovable: Publish)
  • Fix the build errors (or let Try to fix do it), then publish again. (Lovable: Publish)
  • If Bolt can't publish to Netlify, Bolt's own fallback is: run the build command (usually npm run build), download the project, and deploy it to Netlify by hand. (Bolt: Publishing issues)

2. Missing environment variables (the VITE_ prefix)

Lovable and most Bolt apps are built with Vite. Vite only passes variables that start with VITE_ to your app in the browser. A variable called SUPABASE_URL won't be there. (Vite: Env variables)

Your host also doesn't read the .env file from your project. Netlify says its build system doesn't read .env files; you add the values in its settings instead. (Netlify: Build environment variables)

What to do:

  • Copy the exact names from your project's .env file into your host's environment variable settings. (Netlify: Deploy your Lovable app)
  • Then rebuild. VITE_ values are baked in when the app builds, not when it runs. Adding them after the build changes nothing until you deploy again. (Lovable: Hosting outside Lovable)
  • Only put public values in VITE_ variables. Vite's own docs say they end up in the code anyone can download. Private keys belong in server functions. (Vite: Env variables)

3. Supabase URL and key not set on the host

This is the most common version of #2. The app loads, but nothing saves, lists are empty, or sign-in does nothing. Netlify's Lovable guide says a site deployed by drag-and-drop (no build, no environment variables) loads but fails every data call. (Netlify: Deploy your Lovable app)

What to do: set these on your host, copied from your .env:

  • VITE_SUPABASE_URL
  • VITE_SUPABASE_PUBLISHABLE_KEY (older projects use VITE_SUPABASE_ANON_KEY)
  • VITE_SUPABASE_PROJECT_ID if your Lovable project has it

(Lovable: Hosting outside Lovable, Netlify: Deploy your Lovable app)

Newer Lovable projects that use server functions also need SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY for the server side, plus any secrets those functions read. (Lovable: Hosting outside Lovable)

4. 404 when you refresh a page

The home page works. You click to /dashboard, it works. You refresh, and get a 404. This happens because the host looks for a real file called /dashboard and there isn't one. Your app handles that route in the browser.

What to do: tell the host to send every route to index.html.

One exception: Lovable projects created from May 13, 2026 are built on TanStack Start and run a server part. For those, a 404 usually means the host isn't running that server part, not a missing rewrite. Vercel and Netlify detect it on their own; on Vercel, it needs @lovable.dev/vite-tanstack-config at ^2.6.2 or higher. (Lovable: Hosting outside Lovable, Vercel: Lovable)

5. Login redirects back to the wrong place

Sign-in works in the preview, but on your real domain users land on localhost, the old preview link, or an error. Supabase only sends people to addresses you've allowed.

What to do: in your Supabase dashboard, open Authentication → URL Configuration (direct link).

  • Set Site URL to your live address. Supabase says this setting is critical for email confirmations and password resets. (Supabase: Redirect URLs)
  • Add your live address, and any preview addresses you use, to Redirect URLs. (Supabase: Redirect URLs)
  • If you use Google sign-in or another OAuth provider, add your live domain to that provider's allowed redirect URLs too. (Lovable: Hosting outside Lovable)

6. Wrong Node version

Bolt builds inside a browser-based environment that can differ from your host's. A build that passes in Bolt can fail on the host because of the Node version. (Netlify: Deploy your Bolt app)

What to do:

7. Wrong build output folder (blank page)

If the deploy "succeeds" but you see a blank page or a folder listing, the host may be serving the wrong folder. Vite writes the finished site to dist. Create React App uses build. (Netlify: Deploy your Bolt app)

What to do: set the build command to npm run build and the publish (output) directory to dist. On Vercel, Lovable says no output directory setting is needed. (Lovable: Hosting outside Lovable)

A quick check after any deploy

Lovable suggests testing a new host before you switch over: open a deep page directly and refresh, sign in and out, and try the reads, writes and uploads your app depends on. (Lovable: Hosting outside Lovable)

Still stuck?

Want to know if your live app is exposing keys? Our free instant check scans your homepage and its JavaScript for leaked keys and reviews your security headers. It can't see your database.

Want it fixed and deployed for you? Fix & Deploy ($249) is everything in the Security Fix plus the production deploy to one host (Vercel or Netlify, or Lovable or Replit hosting, depending on your builder): env vars, Supabase auth redirect URLs, custom domain with SSL, and a smoke test. See Fix & Deploy

FAQ

Why does my Lovable app work in the editor but not when deployed?

The production build is stricter than the preview, and your host doesn't have the values from your .env file until you add them. Check the build error first, then your VITE_ variables.

Why do I get a 404 when I refresh a page?

The host is looking for a file that doesn't exist. Add a rewrite that sends every route to index.html: /* /index.html 200 in Netlify's _redirects, or a rewrite in vercel.json.

Why does login send users to localhost?

Your Supabase Site URL still points at your old or local address. Change it to your live domain under Authentication → URL Configuration, and add the domain to Redirect URLs.

Do I need to rebuild after adding environment variables?

Yes. VITE_ values are baked in at build time, so deploy again after you add or change them.

Sources