Fix a Lovable app that breaks after a deploy

The app works in Lovable and on localhost, then breaks on the new host. Almost always it is one of three things: the host does not know about the pages of your app, the build did not get its settings or the build itself fails.

Works on localhost, breaks on the host

Which kind of app you have

Open package.json in your repository. If it lists @tanstack/react-start, it is a TanStack Start app (Lovable apps since 13 May 2026). Otherwise it is a Vite app. The fixes below say which kind they are for.

A 404 error when you reload a page

The home page opens, a link inside the app works, but reloading /dashboard gives a 404. That is a Vite app: it is one page, and the browser builds the other pages. The host looks for a file called dashboard, does not find it and gives up. The host must send every address to index.html. A TanStack Start app does not have this problem.

On Vercel, add a vercel.json file to the root of the project:

{ "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] }

Cloudflare Pages does this on its own, unless the build has a 404.html file. If you see a 404 there, look for that file in the dist folder.

On your own server, the web server needs the same rule. With PanelAlpha Engine, ask your AI tool: "Reloading a page other than the home page gives a 404 error on PanelAlpha Engine. Read the deploy log and fix it."

A blank page or no data

The page loads but stays white, or shows no data. Open the browser console (right click, Inspect, Console). An error about Supabase or a missing URL means the build did not get its settings.

Values that start with VITE_ go into the app when it is built, not when it runs. The build reads them from the .env file in your repository. If you changed them in the settings of the host, deploy again: on Vercel a change applies only to new deployments.

A TanStack Start app also runs server code, and that code reads SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY from the settings of the host. Add both with the same values as in .env and deploy again.

The build fails

Build the app on your computer first. Paste this into Claude Code, Codex or Cursor:

Run npm run build and fix any error. Then commit and push the fixes to GitHub.

If it builds on your computer but not on the host, check the Node.js version. Lovable recommends Node 22. Vercel uses Node 24 unless you pick another one in Settings, Build and Deployment, Node.js Version. On Cloudflare Pages set NODE_VERSION in the variables of the project, or add a .nvmrc file with 22 in it.

Login sends people back to Lovable

The app works, but after a login you land on the old lovable.app address. The login settings still name it. Add the new address to the redirect URLs of your backend.

Sources

  1. Vercel docs: Vite on Vercel
  2. Vercel docs: Environment variables
  3. Vercel docs: Node.js versions
  4. Cloudflare docs: Serving Pages
  5. Cloudflare docs: Pages build image
  6. Lovable docs: Deploy and host outside Lovable

Read next

Pick your route.

Choose where you are and where you want to go. The guide takes it from there.