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-startinpackage.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 toindex.htmlfor 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
- 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.
- Open
package.jsonand the README to see the stack and the install and start commands. Lovable says to check them "for what you need installed." - Use Node.js 22, which Lovable's docs recommend.
- Install with the lockfile you have. If there's only
bun.lock, Lovable says to "use Bun for installation or runnpm installlocally and commit the generatedpackage-lock.json" before usingnpm ci. - Copy the values from the project's
.envfile. A project on the built-in backend needsVITE_SUPABASE_URL,VITE_SUPABASE_PUBLISHABLE_KEY, andVITE_SUPABASE_PROJECT_IDfor the browser. TanStack Start apps also needSUPABASE_URL,SUPABASE_PUBLISHABLE_KEY, andSUPABASE_PROJECT_IDfor the server. Add any server function secrets yourself. - Build with
npm run build. Set theVITE_values before the build, not after. - TanStack Start: deploy to a platform that runs the server, or build with
NITRO_PRESET=node-server npm run buildand startnode .output/server/index.mjs. - React + Vite: deploy
dist/, and add a fallback rewrite to/index.htmlif direct URLs return 404. - 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
Related fixes
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.