build exited with 1

Vercel Build Exited With 1 — Fix Deploy Failures

Server & Cloud Intermediate 👁 6 views 📅 Jun 16, 2026

Build fails on Vercel with exit code 1. Almost always a missing dependency or config issue. Here's the exact fix.

Quick answer

Run npm install locally, check your package.json for missing deps, and ensure your build command matches your framework (e.g., next build for Next.js). If that doesn't work, delete node_modules and package-lock.json, then rebuild.

What's happening

That build exited with 1 error on Vercel is the most common deployment failure I've seen. It means your build script returned a non-zero exit code — something crashed. The culprit is almost always a dependency issue: a package that installs fine locally but fails on Vercel's servers. Maybe it's a native module that needs a specific OS package, or you're missing a dev dependency that should be a regular dependency. Sometimes it's a misconfigured build command, like trying to run next build without having Next.js listed in dependencies.

I've fixed this for dozens of projects running Next.js, React, Vue, and SvelteKit. The fix is straightforward, but you need to check the build logs. Vercel shows you the actual error output — read it carefully. It'll point you straight at the issue.

Fix steps (numbered)

  1. Check the build logs. Go to your Vercel dashboard, click the failed deployment, and scroll to the error. Look for lines like Module not found, Cannot find module, or command not found. That's your clue.
  2. Verify package.json. Open your package.json. Make sure all packages you import are listed under dependencies (not devDependencies). Vercel by default only installs dependencies for production builds. If you use a tool like Tailwind CSS or PostCSS, they need to be in dependencies unless you set VERCEL_NPM_DEV_DEPENDENCIES.
  3. Run a fresh install locally. Delete node_modules and package-lock.json (or yarn.lock). Then run npm install again. This mimics what Vercel does. If it fails locally, you'll see the same error. Fix it there first.
  4. Check your build command. In your Vercel project settings, the build command must match your framework. For Next.js, it's next build. For React with Create React App, it's react-scripts build. If you're using a monorepo, you might need cd app && next build.
  5. Pin Node version. In package.json, add "engines": { "node": "18.x" }. Or set it in Vercel's project settings under Node.js Version. I've seen builds fail because a newer Node version broke a package.
  6. Use a .vercelignore file. If you have large files or folders that shouldn't be uploaded (like .git, node_modules already gets ignored, but add *.local), create a .vercelignore file and list them. This prevents weird upload issues.
  7. Test with a fresh deploy. Push a small change, like adding a comment in your main file, and redeploy. Sometimes Vercel caches a bad build. A new push forces a clean build.

Alternative fixes if the main ones fail

If those steps don't work, try these:

  • Switch package manager. Delete package-lock.json and node_modules. Then run yarn install (if you have a yarn.lock). Vercel supports npm, yarn, and pnpm. Sometimes npm's lockfile causes issues. Use yarn or pnpm.
  • Set VERCEL_NPM_DEV_DEPENDENCIES. In Vercel environment variables, add VERCEL_NPM_DEV_DEPENDENCIES=1. This forces Vercel to install devDependencies too. Helpful for build tools like esbuild or TypeScript that need to be available during build.
  • Use a custom install command. In Vercel project settings, set the Install Command to npm ci instead of npm install. The ci command uses the lockfile exactly, no updates. This catches lockfile mismatches.
  • Check for native modules. If you're using sharp, bcrypt, or similar, they need native compilation. Vercel supports that, but you might need to add a postinstall script. For sharp, add "postinstall": "sharp-cli --check" in package.json.
  • Review your vercel.json. If you have a vercel.json file with custom build or install commands, double-check the syntax. A typo there will cause a failure. Example: { "buildCommand": "next build" } — make sure it's valid JSON.

Prevention tip

The best way to avoid this is to test your build locally before pushing. Run the exact same build command that Vercel uses. For Next.js, that's next build. For a CRA app, it's react-scripts build. If it passes locally 99% of the time, it'll pass on Vercel. Also, always keep your lockfile in version control — don't add it to .gitignore. Vercel uses it to reproduce your install exactly. Finally, set up a CI pipeline (like GitHub Actions) that runs the build on every push. That catches issues before they reach production.

Was this solution helpful?