published fresh until

Vercel build fails but passes locally: what do I compare?

Summary As of November 2026, Vercel's troubleshooting guide says to build locally first, then read the build log for the earlier 'Error' line (the last line often just says the command exited with 1). Compare the Node.js version (project setting or package.json engines), and check build limits: memory and disk depend on the build machine type, with a 45-minute maximum (checked 2026-11-15).

Not for env var undefined at runtime, preview URL crawled

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

npm run build is green on your machine, but the Vercel deployment fails. The final log line is only Command "npm run build" exited with 1, which does not say why.

What the docs say

Vercel's Troubleshooting Build Errors (last updated 21 September 2026):

  • Open the failed deployment's build logs and look for the red "Error" lines. The last mention is often not the useful one; read a few lines above. Vercel recommends running the build locally first to catch code and dependency issues.
  • Some builds produce no logs: an invalid vercel.json, Ignored Build Steps, commits from a user who is not a team member, or a Marketplace integration that failed to provision. The error then appears as an overlay instead.
  • Limits: memory, CPUs and disk depend on the build machine type, with a 45-minute maximum (checked 2026-11-15). Setting VERCEL_BUILD_SYSTEM_REPORT=1 produces a report for every build that helps spot hidden out-of-memory events and large files.
  • The build cache is keyed by team, project, framework preset, root directory, Node.js version, package manager and git branch; redeploy without the existing cache (or VERCEL_FORCE_NO_BUILD_CACHE=1) to rule it out.
  • As of November 2026, the Node.js versions page says new projects use the latest LTS (26.x, with 24.x and 22.x also available), the project setting sets the version for new deployments, and engines.node in package.json overrides it (checked 2026-11-15). Check what it ran with node -v in the build command.

How to describe it to your agent

Our Vercel build fails but npm run build passes locally. Compare, in order: Node version locally (node -v) versus the Vercel project setting and engines in package.json; package manager and lockfile used; env vars the build needs in the right Vercel environment; the build log lines above the final exit message. Reproduce with the same Node major version before changing code.

Mistakes to check

  • Local Node differs from Vercel's, so the agent "fixes" code that was fine.
  • Reading only the last log line.
  • Missing environment variables for the Preview environment only.
  • Assuming a cached build state; redeploy without cache once.

Limits

From Vercel's docs; not deployed or reproduced here.

Primary source

Primary sources: Vercel's Troubleshoot Build Errors (last updated 21 September 2026) and Supported Node.js versions (last updated 27 February 2026). Checked: reading the lines above the final exit message, builds without logs (invalid vercel.json, Ignored Build Steps, non-team-member commits, failed Marketplace provisioning), memory, CPU and disk allocations depending on build machine type and the 45-minute maximum (checked 2026-11-15), VERCEL_BUILD_SYSTEM_REPORT=1 and VERCEL_FORCE_NO_BUILD_CACHE=1, new projects using the latest LTS (26.x default, 24.x and 22.x available as of November 2026), engines.node overriding the project setting, and node -v in the build command. The build cache key list was not re-read in full.

Started from a post by @Vercel docs, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Vercel build fails but passes locally: what do I compare?
Summary: As of November 2026, Vercel's troubleshooting guide says to build locally first, then read the build log for the earlier 'Error' line (the last line often just says the command exited with 1). Compare the Node.js version (project setting or package.json engines), and check build limits: memory and disk depend on the build machine type, with a 45-minute maximum (checked 2026-11-15).
Copy for agent
get the whatworks thread build-passes-locally-fails-on-vercel-compare-node-version-and-logs and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread build-passes-locally-fails-on-vercel-compare-node-version-and-logs
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks