VibeRescue · Blog

Lovable app 404 on Vercel or Netlify after export: find your stack, then fix it

October 26, 2026 · 11 min read

You connected your Lovable project to GitHub, imported the repository into Vercel or Netlify, and the build went green. Then you opened the live URL and got a 404: NOT_FOUND page. Or the home page loads, but refreshing /dashboard gives a 404. You add the vercel.json rewrite every forum answer suggests, redeploy, and nothing changes.

The reason is usually that there are now two kinds of Lovable app, and they need opposite fixes. Lovable's own docs say projects created from May 13, 2026 are built with TanStack Start, which renders pages on a server, while older projects are plain React + Vite single-page apps that build to static files. The rewrite that fixes an old app does nothing for a new one, because a TanStack Start app needs a host that runs its server code. This guide shows how to tell which one you have and fixes each one, step by step. If your problem is a blank page rather than a 404, start with Lovable app works in preview but breaks after deploy.

Step 0: find out which stack your project uses (1 minute)

Open package.json in your GitHub repository (or in Lovable's Code tab). Lovable's docs give this test:

What you see in package.jsonYour stackWhat the host has to doGo to
@tanstack/react-start is listed under dependenciesTanStack Start (projects created from May 13, 2026)Run the server part: server-side rendering, server functions and API routes2 and 3
No @tanstack/react-start; react-router-dom and vite insteadOlder React + Vite single-page appServe the static dist/ folder, with a fallback to index.html for every route1

If you're not sure, ask Lovable in the project chat: "Which stack does this project use, older React + Vite or TanStack Start?" That question comes straight from Lovable's hosting guide.

Read the 404 before changing anything

Where the 404 comes from narrows the cause down quickly:

What you seeLikely causeGo to
Older app: home page works, refreshing or opening /dashboard directly shows the host's 404 pageNo fallback to index.html for client-side routes1
TanStack Start app: build is green, but every URL, including /, shows Vercel's 404: NOT_FOUNDVercel got static files (or nothing it recognizes) instead of a server build2
TanStack Start app: it works on one host but not anotherThe build is pinned to a different platform's preset3
The build fails on the host but works on your computer or in LovableLockfile, package manager or Node version mismatch4
Pages load but data, login or server functions failMissing environment variables or redirect URLs, not routing5

Also open the deployment's build log and function logs on your host for the same minute. On Vercel, a 404 page with an ID like NOT_FOUND comes from the platform itself, which means your app never got the request.

1. Older React + Vite app: add the index.html fallback

Signature: package.json has no @tanstack/react-start, the home page loads, and any other route returns 404 when opened directly or refreshed.

An older Lovable app has one real HTML file, index.html. React Router decides what to show in the browser. When someone opens /dashboard directly, the host looks for a file called dashboard, finds none, and returns 404. Lovable's docs say to configure a fallback so every route serves /index.html, and the method depends on the host.

Vercel: add vercel.json at the repository root:

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

Netlify: Lovable's docs point to a _redirects file. Put it in public/ so Vite copies it into dist/, with this rule:

/*    /index.html   200

Cloudflare Pages: if your build has no top-level 404.html, Pages treats the project as a single-page app and serves index.html for unknown routes. A 404.html left in public/ turns that off.

Apache or shared hosting: Lovable's docs give this .htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Build settings for older apps, from Lovable's docs: build command npm run build, output directory dist, Node.js 22. For a storage bucket behind a CDN, Lovable warns not to rely on the bucket's error-page setting, because it answers with a 404 status code. Configure the CDN to return index.html with a 200 instead.

2. TanStack Start app: give the host a server build

Signature: package.json lists @tanstack/react-start, the deploy succeeds, and the live site is a 404 everywhere, or SSR pages and server functions fail while the same project works on Lovable's hosting.

A TanStack Start app is closer to Next.js than to a static site. Lovable's docs are direct: a host that receives only the static files does not run server-side rendering, server functions or API routes. Lovable's build config, the @lovable.dev/vite-tanstack-config package, uses Nitro to package the server output for whichever platform it builds on. Nitro calls each target a preset. Inside Lovable the preset is fixed; outside Lovable, the build picks the preset for the platform it detects, or the one you name.

Don't add the SPA rewrite

Lovable's docs say not to use the index.html fallback from the older examples for a TanStack Start app, because the server handles routing. If you already added a catch-all vercel.json rewrite or a _redirects file while trying to fix the 404, remove it.

Update the Lovable build config and check Nitro is installed

Vercel's Lovable docs say zero-configuration detection needs @lovable.dev/vite-tanstack-config at version ^2.6.2 or higher. Lovable's docs add that package.json must list nitro: without it, the build doesn't package the app for a hosting platform, and older build configurations can skip Nitro outside Lovable or write to a different output folder.

npm install "@lovable.dev/vite-tanstack-config@^2.6.2" nitro
git add package.json package-lock.json
git commit -m "Update Lovable build config for external hosting"
git push

Lovable's Git sync works both ways, so this commit also reaches the Lovable editor. Check that the Lovable preview still works after the change (see section 6).

Host settings

HostBuild commandOutput / publish directoryNode.js
Vercelnpm run buildLeave empty: Vercel needs no output directory22
Netlifynpm run builddist22
Cloudflare Pagesnpm run builddist22

These values come from Lovable's hosting guide. On Vercel, also clear any Output Directory or Build Command override left over from an earlier attempt, and make sure the project isn't set up as a plain static Vite site. Then redeploy. If you changed settings rather than code, choose Redeploy on the latest deployment so the new settings apply.

Hosts that can't run it

GitHub Pages, an S3 or Cloud Storage bucket behind a CDN, Netlify Drop and plain shared hosting only serve files. Lovable's docs say a TanStack Start app doesn't run from object storage or a CDN alone. Use a platform Nitro detects, a container, or your own server (section 3).

3. The build targets the wrong platform

Signature: the same repository works on one host and 404s on another, or you followed a forum fix that hard-codes a preset.

Nitro builds a different output for every platform, so a preset pinned to one host produces something the next host can't serve. Look for:

On Vercel, Netlify and Cloudflare Pages, Lovable's docs say a build from your repository picks the matching preset with no configuration, so with a current build config you can usually delete the override. Vercel's docs likewise say no manual build configuration is needed for Lovable projects. In some projects the generated vite.config.ts carries a comment that Nitro builds with Cloudflare as the default target, which explains why an old config can keep producing a Cloudflare build on Vercel.

For a VPS, a container or any host Nitro doesn't detect, Lovable documents the Node.js server preset:

NITRO_PRESET=node-server npm run build
node .output/server/index.mjs

The server listens on port 3000 (set PORT and HOST to change it). Put it behind your reverse proxy for HTTPS, and don't add the Nginx try_files fallback from the older examples, because the server does the routing.

4. Builds on your computer, fails on the host

Signature: the deploy itself is red, so you never even get to the 404.

5. Not a 404: pages load, but data, login or server functions fail

Once routing works, the next break is usually configuration that lived only inside Lovable:

For the full variable checklist across hosts, see Environment variables missing in production.

6. Keep Lovable and your host in step

A check before you switch your domain

Lovable's hosting guide lists these checks on the new host, against the app running on Lovable:

How to prompt Lovable so it doesn't make things worse

Asking "fix the 404 on Vercel" invites the AI to bolt a static-site rewrite onto a server app, or to rewrite your routing. Give it the stack, the evidence and a narrow job instead:

This project deploys from GitHub to [Vercel/Netlify]. The build succeeds but [every route / only refreshed routes] return 404.
1. Tell me which stack this project uses: TanStack Start or older React + Vite.
2. If TanStack Start: check that @lovable.dev/vite-tanstack-config is ^2.6.2 or newer and that nitro is in package.json.
   List any NITRO_PRESET or nitro preset override and any SPA rewrite file (vercel.json, _redirects). Don't add a rewrite.
3. If React + Vite: add only the index.html fallback for [host].
4. List every environment variable the browser and the server code read.
Change only build and hosting config. Don't touch routes, components, auth or database code.

If the answer is a host setting (output directory, Node version, environment variables), no code change will help. Make the change on the host and redeploy.

FAQ

Why does my Lovable app show 404: NOT_FOUND on Vercel when the build succeeded?

Projects created in Lovable from May 13, 2026 use TanStack Start and need a host that runs their server code. If Vercel gets only static files, or an old build config that doesn't produce a Vercel server build, nothing answers the request. Update @lovable.dev/vite-tanstack-config to ^2.6.2 or newer, make sure nitro is in package.json, clear any output directory override and redeploy.

Should I add a vercel.json rewrite to /index.html?

Only for an older React + Vite Lovable app, where it fixes 404s on refreshed routes. Lovable's docs say not to use that fallback for a TanStack Start app, because the server handles routing. Check package.json first: if it lists @tanstack/react-start, remove the rewrite instead.

How do I know if my Lovable project is TanStack Start or React + Vite?

Open package.json in the Code tab or your GitHub repository. A TanStack Start project lists @tanstack/react-start under its dependencies; an older React + Vite project does not. You can also ask Lovable in the project chat which stack the project uses.

Which output directory should I set for a Lovable app?

For an older React + Vite app, dist. For a TanStack Start app, Lovable's docs say dist on Netlify and Cloudflare Pages, and no output directory setting on Vercel. Use npm run build and Node.js 22 in both cases.

Can I host a new Lovable app on GitHub Pages or shared hosting?

Not a TanStack Start app. Those hosts only serve files, and Lovable's docs say a TanStack Start app doesn't run from static hosting or a CDN alone. Use a platform Nitro detects, such as Vercel, Netlify or Cloudflare Pages, or build with NITRO_PRESET=node-server and run node .output/server/index.mjs on a server or container.

Not sure which of these it is?

Run the free Rescue Scan: paste a public GitHub repo and VibeRescue, an automated AI repair tool, classifies the problem (code bug, missing files, or missing secrets) before you pay anything. If it is something you can fix with this guide, we will tell you. If you want a fix run, it opens a pull request, with a full refund if the run can't fix it.

Run the free Rescue Scan →