---
title: "App works on my laptop but not on the server"
description: "Usually missing environment variables, a stricter production build, or a different Node version. How to read the build log, check each one, and fix it."
url: https://whocanfixmyapp.com/problems/app-works-on-my-laptop-not-on-the-server
---

[Home](https://whocanfixmyapp.com/) / [Problems](https://whocanfixmyapp.com/problems) / [Deploy and go live](https://whocanfixmyapp.com/problems#deploy-and-go-live)

# App works on my laptop but not on the server

VC-22 · Cursor · Claude Code · Vercel · Updated October 2026 · By [Nathaniel Kelley](https://whocanfixmyapp.com/authors/nathaniel-kelley)

Quick verdict

Partly fixable yourself. Often a missing setting on the host, not code.

- **How serious**: High
- **Fix it yourself?**: Partly, some steps need a developer
- **Typical cost**: $49–$800 one-off check, or €99–$990 for a single fix ([prices](https://whocanfixmyapp.com/pricing))
- **Top rated for Cursor**: [Afterbuild Labs](https://whocanfixmyapp.com/companies/afterbuild-labs) · **10.0**/10

**What you see.** Everything runs on localhost, but the deployed version shows errors, empty data, or a failed build.

## Why it happens

Your laptop has things the server does not. The biggest one is the `.env` file. Next.js loads variables from `.env` files on your machine, but the default template adds those files to `.gitignore`, so they never reach the host. On Vercel, values live in the project's Environment Variables settings, and a change there only applies to new deployments. Variables meant for the browser need the `NEXT_PUBLIC_` prefix and are frozen into the code at build time.

Second, the dev server is forgiving. `next dev` skips checks that `next build` enforces, so type errors and missing imports only surface on the server. Third, versions differ. Vercel builds with the latest Node.js LTS by default unless your `package.json` engines field says otherwise. Fourth, the code may point at `localhost` or a local database the server cannot reach. Coding agents like Cursor and Claude Code write such paths without telling you.

## Fix it yourself

1. Open the failed deployment in Vercel and read the build log down to the first red line. Copy the exact error text before changing anything.
2. Run `npm run build` on your laptop. If it fails the same way, the problem is in the code, not the host.
3. Compare your `.env.local` file with **Project → Settings → Environment Variables** in Vercel. Add every missing name and value, tick the Production environment, then redeploy.
4. Search the code for `localhost`, `127.0.0.1`, and hardcoded file paths. Replace them with environment variables.
5. Check **Settings → Build and Deployment → Node.js Version** in Vercel and match it to `node -v` on your laptop, or set `engines.node` in `package.json`.
6. Ask the agent to fix only the first error from the log, redeploy, and repeat. Do not ask it to fix the deployment in general.

## When to get an engineer

Stop when the environment variables are in place and the build still fails, or when the build passes but pages crash with errors you cannot read. Give the engineer the build log, the list of variable names (never the values), and the repository link. Expect a one-off check at $49–$800 or a single fix at €99–$990, usually within 1–2 days. The deep page [works on localhost, breaks in production](https://whocanfixmyapp.com/problems/claude-code-works-on-localhost-breaks-in-production) covers the agent-specific traps.

## Top-rated companies for Cursor apps

Ranked by our score: published prices, scope of work, AI tools named, timing and a low-risk first step. [How we score](https://whocanfixmyapp.com/methodology#score).

- 1 · [Afterbuild Labs](https://whocanfixmyapp.com/companies/afterbuild-labs) · **10.0**/10 · Best for: A check before launch · Free first step · from $49
- 2 · [Redlab](https://whocanfixmyapp.com/companies/redlab) · **10.0**/10 · Best for: A full rescue by one team that keeps building · Free first step · from $490
- 3 · [Vibe Code Rescue (Lev Arakelyan)](https://whocanfixmyapp.com/companies/vibe-code-rescue-lev-arakelyan) · **9.0**/10 · Best for: A one-off check and a cleanup · From $299

[All 58 Cursor companies, ranked](https://whocanfixmyapp.com/best/cursor-developers)

## Check these

OPS-04 · Medium

Secrets live in the host's environment settings

Keys belong in environment variables on the server, not in the repository or in front-end code.

CODE-01 · High

The code lives in a Git repository you own

Connect GitHub or export the project. If the builder account is lost, the product should not be.

OPS-02 · High

Testing and real users use separate databases

Experiments and AI agents should never run against production data.

OPS-03 · High

Errors reach you before users do

Add error monitoring and uptime alerts. If you learn about outages from customers, this is missing.

## Questions

### Why does my .env file not work on Vercel?

It never left your laptop. The file is ignored by Git, so the host never sees it. Vercel reads values only from the project's Environment Variables settings, and only for deployments made after you add them.

### Can I just copy the .env file into the repository?

No. That publishes your secret keys to everyone with repository access. Add each value in the host's settings instead, and keep the file out of Git.

Sources: [Vercel: Environment variables](https://vercel.com/docs/environment-variables); [Vercel: Managing environment variables](https://vercel.com/docs/environment-variables/managing-environment-variables); [Next.js: Environment variables guide](https://nextjs.org/docs/app/guides/environment-variables); [Vercel: Supported Node.js versions](https://vercel.com/docs/functions/runtimes/node-js/node-js-versions).

**Cursor guide**

What Cursor builds, where it breaks and how to check it: [Cursor and Windsurf apps: when AI-written code needs an engineer](https://whocanfixmyapp.com/guides/cursor).

**Same category**

- [Lovable app not working: what breaks between preview and production](https://whocanfixmyapp.com/problems/lovable-app-not-working)
- [Base44 app not loading or stuck on Thinking: what it usually means](https://whocanfixmyapp.com/problems/base44-app-not-loading)
- [v0 app needs a backend and deployment: what to add before real users](https://whocanfixmyapp.com/problems/v0-app-needs-a-backend)
- [Claude Code or Cursor app works on localhost, breaks in production](https://whocanfixmyapp.com/problems/claude-code-works-on-localhost-breaks-in-production)
- [Lovable publish fails with a build error](https://whocanfixmyapp.com/problems/lovable-publish-failed-build-error)
- [Lovable custom domain stuck on Verifying or Setting up](https://whocanfixmyapp.com/problems/lovable-custom-domain-stuck-verifying)

[All deploy and go live problems](https://whocanfixmyapp.com/problems#deploy-and-go-live)

**Run every check**

The [production checklist](https://whocanfixmyapp.com/checklist) has all 24 checks with a verdict.
