Vercel "Command failed with exit code 1" build in CI
Vercel ran your configured build command and it returned a non-zero exit code, so the build stops. The real failure is in the build log above this summary line, not in Vercel itself.
What this error means
The Vercel build log ends with "Error: Command \"npm run build\" exited with 1" (the quoted command matches your build script).
Error: Command "npm run build" exited with 1Common causes
The build script itself failed
A type error, a failing lint, or a thrown exception during the build returned exit code 1, which Vercel surfaces as a failed command.
A missing dependency or env var at build time
The build references a package or environment variable that is present locally but absent in the Vercel build environment.
How to fix it
Read the build log above the summary
- Scroll up to the first error printed by the build command.
- Reproduce it locally with the same command and Node version.
- Fix the underlying error, then redeploy.
Provide missing build env vars
Add any environment variables the build needs in Vercel project settings or pass them in CI, and pin the Node version to match local.
# vercel.json
{
"build": { "env": { "NODE_VERSION": "20" } }
}How to prevent it
- Run the exact build command in CI before deploying to catch failures early.
- Keep build-time env vars defined in project settings.
- Pin the Node version so local and Vercel builds match.