Skip to content
>_VibeUnstuck

Lovable export code won't run: bun install

Last verified:

The fix

Lovable export code won't run until you install with the lockfile in the folder. bun.lock means bun install, then the dev script. Do not add Next.js.

  1. 1

    Install with the lockfile in the folder

    bun.lock or bun.lockb means bun install, then bun run dev. package-lock.json and no Bun lock means npm ci. pnpm-lock.yaml means pnpm install. Do not delete the lockfile. If the error names an engine, use Node.js 22 for a TanStack Start build.

    # bun.lock or bun.lockb in this folder
    bun install
    bun run dev
    
    # package-lock.json, and no bun lock
    npm ci
    npm run dev
  2. 2

    Run the dev script, not Next

    Read scripts.dev in package.json and run that script. If dependencies lists @tanstack/react-start, you need that dev server. Opening index.html does not start it. Do not add Next so next dev exists, and do not change the dev script to next dev.

  3. 3

    Separate a missing secret from a missing install

    A missing module means the install did not finish. supabaseUrl is required means the URL was empty when the client was created. A built-in backend export already has VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY in .env. Restart the dev server after you change .env. Do not put a service role or an sk_ key in a VITE_ variable.

  4. 4

    Prove the dev server, then stop

    The dev script prints a local URL and that page loads. That is the export running. A push to the synced branch updates the Lovable preview after the sync card catches up. It does not publish, and it does not deploy an edge function or run a migration you added in git.

Why it happens

Download codebase and Git sync give you source, not node_modules. The zip is on paid plans: Download codebase at the bottom of the code editor file panel, or Project settings, then Git. On an Enterprise workspace, admins can limit that zip to admins and owners. Git sync is on every plan. Connecting it creates a new repository. You cannot point it at a repo you already have. After that, the synced branch goes both ways. Clone once the sync status card says both sides are on the same commit.

Lovable installs with Bun, so the folder has bun.lock (or bun.lockb on an older project). The hosting doc says the install command and the lockfile have to match. npm ci reads package-lock.json and cannot start without it. New projects from May 13, 2026 list @tanstack/react-start and need that dev server. Older projects are React + Vite. A TanStack Start production build wants Node.js 22. Secrets stored in Lovable are not in the zip or the repository.

The next error you'll probably hit

Once this is fixed, the usual follow-up is supabaseUrl is required. supabaseUrl is required: createClient got an empty URL or key, missing when the bundle was built. Set the Supabase URL and anon key, then rebuild.

Prompt to paste back into your AI tool

Paste this above the error.

The Lovable export code won't run on my machine. The lockfile in this folder is:
<bun.lock, bun.lockb, package-lock.json, or pnpm-lock.yaml>

The dev script in package.json is:
<paste the dev script>

The first error from install or from that script is:
<paste the first error>

Do not add Next.js. Do not delete the lockfile. Do not use --legacy-peer-deps unless you name the peer conflict. Do not put the Supabase service role or a Stripe secret in a VITE_ variable. Do not regenerate the project.

1. Install with the package manager that matches the lockfile. bun.lock means bun install.
2. Run the existing dev script. If @tanstack/react-start is a dependency, do not tell me to open index.html.
3. If a VITE_ name is missing, name it and tell me to put the public value in .env, then restart. Do not hardcode it. If .env already has VITE_SUPABASE_URL and the publishable key, leave them.
4. If the first error is ERESOLVE, a missing module, or supabaseUrl is required, fix only that. Leave working files unchanged.

Common questions

+It runs inside Lovable. Why does the same code fail after export?

The preview already has dependencies installed, and Lovable injects secrets that the zip and the repository do not contain. You install from the lockfile and start the dev script yourself. Connector and AI calls on a TanStack Start app can still fail on your machine.

+npm ci cannot find a package-lock, or npm run dev says it cannot find next. Did the export break?

npm ci needs package-lock.json. A Lovable folder with only bun.lock installs with bun install. Next is the wrong tool. Read scripts.dev. Do not add Next so the command you typed exists.

+Why won't my downloaded Lovable codebase run?

The zip is source only. It has no node_modules. Install with Bun when bun.lock is in the folder, then run the dev script. If the page boots and one request fails, the missing piece is a public env var or a redirect URL.

+Lovable export code won't run, and npm printed ERESOLVE. What now?

Stop on that install error. It names the dependency that does not match. Fix that pair. Do not delete the lockfile, and do not add --legacy-peer-deps before you have read the peer block.

Related errors