Lovable export code won't run locally or on another host

Code you exported or synced from Lovable won't run on your computer or another host? Check which stack it uses, install with the right lockfile, and set the variables Lovable supplied.

Short answer

Lovable export code that won't run usually lacks something Lovable supplied for you. Check the stack in package.json: TanStack Start apps need a host that runs the server, and older React + Vite apps build to dist. Install with the matching lockfile, use Node.js 22, and set VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY and VITE_SUPABASE_PROJECT_ID from the project's .env before building.

Reviewed October 28, 2026

What it means in plain English

Inside Lovable, hosting, environment values, and the backend connection are handled for you. Outside Lovable, you supply them. Lovable's guide says to run the app on your own computer first, because "a working local run confirms what the app needs installed, its dependencies, and the environment variables it reads."

Lovable builds apps on two stacks, and each runs differently:

  • TanStack Start apps (created from 13 May 2026, or from 22 June 2026 on Enterprise plans) list @tanstack/react-start in package.json. They need "a host that runs the server part: server-side rendering, server functions, and API routes."
  • Older React + Vite apps build static files into dist/ and need a static host "with a fallback to index.html for client-side routes."

Likely causes

  • The Supabase values weren't set. Lovable says variables prefixed with VITE_ "are embedded at build time, not runtime."
  • The install used a different package manager than the lockfile. Lovable notes some repositories have only bun.lock.
  • A TanStack Start app was uploaded to a static-only host, so server features don't run.
  • Server secrets are missing. Lovable says the secrets your server functions read "are not in the repository."
  • Deep links return 404 because the static host has no fallback to index.html.
  • Sign-in fails because the new URL isn't in the auth redirect URLs.

How to fix it, step by step

  1. Get the code through Git sync or Download codebase (paid plans). Both include the source and migration files, but not your database records or stored files.
  2. Open package.json and the README to see the stack and the install and start commands. Lovable says to check them "for what you need installed."
  3. Use Node.js 22, which Lovable's docs recommend.
  4. Install with the lockfile you have. If there's only bun.lock, Lovable says to "use Bun for installation or run npm install locally and commit the generated package-lock.json" before using npm ci.
  5. Copy the values from the project's .env file. A project on the built-in backend needs VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY, and VITE_SUPABASE_PROJECT_ID for the browser. TanStack Start apps also need SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, and SUPABASE_PROJECT_ID for the server. Add any server function secrets yourself.
  6. Build with npm run build. Set the VITE_ values before the build, not after.
  7. TanStack Start: deploy to a platform that runs the server, or build with NITRO_PRESET=node-server npm run build and start node .output/server/index.mjs.
  8. React + Vite: deploy dist/, and add a fallback rewrite to /index.html if direct URLs return 404.
  9. Add the new URL to your authentication provider's allowed redirect URLs.

How to check it worked

  • The app starts locally with the README's start command and loads data from your backend.
  • On the new host, a deep link opens directly, sign-in returns you to the new address, and a server feature works.

Questions people ask

How do I run my Lovable project on my own computer?

Clone the synced repository, then check the README and package.json for what to install and for the commands that install dependencies and start the app.

Why can't my exported Lovable app reach its database?

The Supabase values were probably not set at build time. Lovable says a project on the built-in backend needs VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY and VITE_SUPABASE_PROJECT_ID from its .env file, set before you run npm run build.

Does exporting Lovable code include my database?

No. Lovable says Git sync and Download codebase both include the application source and migration files, but not the records in your database or the files in storage.

Sources

More Lovable fixes

Keep going on your own.

The guides stay free. A deep leak report is $15. Fix packs are $24, or $49 for all three. There is no done-for-you repair.

See products