# Lovable exported code won't run locally

Source: https://www.plutonapps.com/resources/lovable-export-code-wont-run

Published 2026-11-23, updated 2026-11-23, sources checked 2026-11-23. By Irfan Habib (https://www.plutonapps.com/authors/irfan-habib).

A Lovable project that runs in the editor and fails on your laptop is usually missing one of five things: the right Node version, the right package manager, its environment values, the right build target, or a sign-in address. Here is how to tell which.

As of November 23, 2026, when code exported from Lovable will not run on your own computer, the cause is usually one of five things: Node.js is too old, the install used a different package manager from the one the lockfile was made with, the environment values are missing, the project is a TanStack Start app being treated like a static site, or sign-in rejects your local address.

None of these means the code is broken. Lovable's own docs recommend running the app from a clone of the repository before handing it to any host, because that is where missing dependencies and environment values show up first.

This guide is for founders and developers who cloned a Lovable project from GitHub, or downloaded it, and cannot get it to start or build. Platform facts come from Lovable's, Vite's and Supabase's documentation, listed under Sources.

## How do you get a Lovable project running locally?

Get the code from the GitHub sync, install Node.js 22, install packages with the package manager that matches the lockfile, check the .env file, then start the dev script from package.json. Lovable's Git sync is available on all plans; downloading the codebase as a .zip needs a paid plan.

1. **Clone the synced repository** Lovable syncs one branch at a time, by default the repository's default branch, usually main. Clone that branch, not an old fork or a stale download.
2. **Use Node.js 22** Lovable recommends Node.js 22 for builds and hosting. Check with node --version before you install anything.
3. **Install with the matching package manager** If the repository has package-lock.json, install with npm ci. If it only has bun.lock, use Bun, or run npm install once and commit the lockfile it creates.
4. **Check the .env file** Lovable's docs say the browser values, such as VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY, are in the .env file in the repository. If it is missing, the app cannot reach its backend.
5. **Start the dev server, then build** Run the dev script listed in package.json. Before deploying anywhere, also run npm run build, which is the build command Lovable's docs give.

## Which error points to which cause?

The first error usually names the cause. A blank page with supabaseUrl is required. in the console means the .env values are missing; an install or start error that names the Node.js version means Node.js is older than Vite needs (20.19 or 22.12 and later); and no dist folder after a build means a TanStack Start app, which builds into .output and runs as a Node server.

Read the first error in the terminal, or the first red error in the browser console, and match it here.

| What you see | Likely cause | What to do |
| --- | --- | --- |
| An install or start error that names the Node.js version | Node.js is older than Vite needs | Install Node.js 22 |
| Install fails, or different package versions than in Lovable | Lockfile and package manager do not match | Use the manager the lockfile belongs to |
| Blank page with supabaseUrl is required. in the console | VITE_SUPABASE_URL is empty or missing | Restore the .env values, then restart |
| You changed .env but nothing changed | Vite reads .env only when it starts | Restart the dev server; rebuild a build |
| No dist folder after build, or a host serves nothing | It is a TanStack Start app with a server | Run it as a Node server, not static files |
| Pages 404 when you refresh on a static host | An older Vite app with client-side routing | Send every route to index.html |
| Sign-in fails on your local address | The address is not in the redirect URLs | Add 127.0.0.1 with your port and /** |
| Payments, email or AI calls fail | Server secrets are not in the repository | Set them where the server code runs |

## Why does the Node.js version matter?

Lovable apps are built with Vite, and the current Vite documentation says it requires Node.js 20.19 or later, or 22.12 or later, adding that some templates need a newer version still. An older Node.js, which many laptops still have, can fail at install or at start with errors that do not look version related. Lovable recommends Node.js 22, so start there.

## Where do the environment values come from?

Lovable's docs name three browser values, VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY and VITE_SUPABASE_PROJECT_ID, and say they are in the repository's .env file. TanStack Start apps also read SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY and SUPABASE_PROJECT_ID on the server. If the URL is empty, the Supabase client stops with the error supabaseUrl is required., and a missing key gives supabaseKey is required.

- Vite reads .env files when it starts, so restart the dev server after any change.
- Values already set in your shell take priority over the .env file, which can hide an edit.
- VITE_ values are embedded at build time, so a deployed build needs a rebuild after a change.
- Anything prefixed VITE_ ends up in the code every visitor downloads. That is fine for the publishable key and never fine for a secret key. See [what to do if an API key is exposed](https://www.plutonapps.com/resources/lovable-api-key-exposed).

> **Your local copy talks to the live backend** The .env values point at the project's real backend. Unless you change them, every account you create and every row you edit while testing locally lands in the same database your customers use. For real development work, point the local copy at a separate Supabase project.

## Is it a TanStack Start app or an older Vite app?

Open package.json. Lovable's docs say projects created from May 13, 2026 use TanStack Start; if @tanstack/react-start is listed, yours is one. The two kinds build and run differently, and treating one like the other is a common reason a build seems to vanish.

|  | Older React and Vite app | TanStack Start app |
| --- | --- | --- |
| Build output | Static files in dist/ | A .output directory with server code |
| How it runs | Any static host | node .output/server/index.mjs, port 3000 by default |
| Routing | The host must return index.html for every route | The server handles routing; no index.html fallback |
| Build needs | npm run build | npm run build, with nitro listed in package.json |

A TanStack Start app does not run from object storage or a CDN alone, Lovable's docs say, because those serve files but not server code. If inner pages of an older Vite app show a 404 on refresh, the same routing rule is behind it; our article on a [blank page after publish](https://www.plutonapps.com/resources/lovable-blank-page-after-publish) covers that case too.

## Why does sign-in fail on my computer?

Sign-in only redirects to addresses on the project's redirect URL list. On Lovable Cloud, add your local address under More, then Users, then Settings, then Advanced, Redirect URLs. Lovable's docs say it rejects localhost addresses, so use http://127.0.0.1 with your dev server's port and /** on the end. On your own Supabase project, add the address in the project's URL Configuration. Google sign-in with your own credentials also needs the address in Google Cloud; see [Google login not working](https://www.plutonapps.com/resources/lovable-google-login-not-working).

## What only works inside Lovable?

Some parts of a Lovable app are services, not code, and a clone does not bring them along. Lovable's docs list these:

- Server secrets. Keys read by Edge Functions or server functions are not in the repository and must be set wherever that code runs.
- AI features and app connectors. While the project uses Lovable's built-in backend, those calls run through Lovable and use workspace credits.
- Managed sign-in. Managed OAuth and automatic token refresh are only available on the built-in backend.
- Private packages. If the project installs a private npm package through a build secret, the project's .npmrc reads the token by name, and the install fails until you set that token yourself.
- The Publish button, which only ever publishes to Lovable's hosting.

Edge Function code itself is in supabase/functions/ and database changes are in supabase/migrations/, so a developer can deploy both to a Supabase project. Moving the whole backend is a bigger job, covered step by step in our guide to [moving off Lovable Cloud](https://www.plutonapps.com/guides/migrate-off-lovable-cloud).

> **Prompt to paste into Lovable** Add a README section called Running locally. List the Node.js version, the package manager and lockfile, every environment variable the app reads with what it is for (names only, never values), which ones are browser values and which are server secrets, the dev, build and start commands, and any feature that only works on Lovable's hosting. Do not change any app code.

## When should you stop and get help?

Most of the fixes above take minutes. Get an engineer involved when:

- The app runs locally but you need it on your own hosting, with its own backend, for real customers.
- Local testing is writing to the live database and you need a separate development setup.
- The project depends on Lovable AI features or connectors you would need to replace.
- You are taking the code over from someone else and nobody can say which secrets it needs.
- The same build error has come back after three fixes.

Our guide to [taking a Lovable app to production](https://www.plutonapps.com/guides/lovable-app-to-production) sets out what a live app needs beyond running code. If you would rather hire one person, our guide to [hiring a Lovable developer](https://www.plutonapps.com/guides/hire-a-lovable-developer) compares freelancers, agencies and subscriptions on cost and scope. Our [vibe-coding rescue service](https://www.plutonapps.com/services/vibe-coding-rescue) starts with an architecture review of what exists, then fixes what is risky, such as access rules, secrets and payments. Ongoing plans are on our [pricing page](https://www.plutonapps.com/pricing).

## Sources

All checked on November 23, 2026. We review this page every 30 days.

- Lovable docs: Deploying and hosting outside Lovable, on running from a clone, Node.js 22, lockfiles, the build command, output folders, environment variables, routing, secrets and what does not work outside Lovable ([docs.lovable.dev/tips-tricks/external-deployment-hosting](https://docs.lovable.dev/tips-tricks/external-deployment-hosting)).
- Lovable docs: Deployment, hosting, and ownership options, on Git sync on all plans, the paid .zip download and TanStack Start for projects created from May 13, 2026 ([docs.lovable.dev/tips-tricks/deployment-hosting-ownership](https://docs.lovable.dev/tips-tricks/deployment-hosting-ownership)).
- Lovable docs: Sync your Lovable project with GitHub, on two-way sync of one branch and cloning the repository ([docs.lovable.dev/integrations/github](https://docs.lovable.dev/integrations/github)).
- Lovable docs: Users and authentication, on redirect URLs, local addresses and localhost being rejected ([docs.lovable.dev/features/authentication](https://docs.lovable.dev/features/authentication)).
- Lovable docs: Build secrets, on workspace build secrets and .npmrc tokens for private packages ([docs.lovable.dev/features/build-secrets](https://docs.lovable.dev/features/build-secrets)).
- Vite docs: Getting started, on the Node.js versions Vite requires ([vite.dev/guide](https://vite.dev/guide)).
- Vite docs: Env variables and modes, on .env loading, VITE_ values in client code, restarts and precedence ([vite.dev/guide/env-and-mode](https://vite.dev/guide/env-and-mode)).
- Supabase: supabase-js source, on the supabaseUrl is required. and supabaseKey is required. errors ([github.com/supabase/supabase-js](https://github.com/supabase/supabase-js)).

## Frequently asked questions

### Can I run a Lovable project on my own computer?

Yes. Clone the repository from Lovable's GitHub sync, use Node.js 22, install with the package manager that matches the lockfile, and start the dev script in package.json. Lovable's docs recommend doing this before deploying anywhere else, to check dependencies and environment values.

### Why does my Lovable app show a blank page locally?

Usually the environment values are missing. If VITE_SUPABASE_URL is empty, the Supabase client throws supabaseUrl is required. and the page stays blank. Restore the values from the repository's .env file and restart the dev server, because Vite reads .env only when it starts.

### Which Node.js version does a Lovable project need?

Lovable recommends Node.js 22 for builds and hosting. Vite, which Lovable apps are built with, requires Node.js 20.19 or later, or 22.12 or later, and some templates need newer versions.

### Why is there no dist folder after npm run build?

Your project is probably a TanStack Start app, which Lovable uses for projects created from May 13, 2026. It builds into a .output directory with server code and runs with node .output/server/index.mjs, so it needs a host that runs Node, not a static file host.

### Is it safe to run the exported code locally?

Running it is safe, but by default the .env values point at the app's real backend, so test sign-ups and edits land in your live database. For ongoing development, point the local copy at a separate Supabase project.
