Vercel build fails: Type error / ESLint errors (works locally)
Published
The error
Failed to compile. Type error: ... / Error: Command "npm run build" exited with 1
Why it happens
next dev doesn't run a full type check, but next build does, and it fails on TypeScript and (in some versions) ESLint errors. Case-sensitive file imports also break on Linux build servers while working on Mac/Windows.
How to fix it
- Run npm run build locally to reproduce.
- Fix the reported type errors rather than disabling checks.
- Check import paths match file names exactly, including case.
- Make sure the lockfile is committed and the Node version matches.
Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)
My Vercel build fails with the error below but works with npm run dev. Run the production build, fix every TypeScript and lint error properly (no ts-ignore or ignoreBuildErrors), fix any import path whose casing doesn't match the file name, and confirm npm run build passes. Error log: <PASTE LOG>
Error codes this fixes
FAQ
Can I set ignoreBuildErrors?
It ships, but hides real bugs. Use it only as a temporary stopgap.
Why does casing matter?
Vercel builds on Linux, which has a case-sensitive filesystem.
Sources
Based on the official documentation:
Related fixes
- App works on localhost but breaks in production: a checklist to find the cause
- 404 NOT_FOUND when refreshing a page (React/Vite SPA)
- CORS error: blocked by CORS policy: No 'Access-Control-Allow-Origin' header
- Replit deploy: app not reachable / port not open
Want the full checklist for this area? Get a Fix Kit ($29)
Featured slot available: reach thousands of vibe coders. Sponsor this week →
Get one new fix a week
Free newsletter: the newest breakages in Lovable, Bolt, Cursor, Replit and v0 apps, with paste-in fixes.
We only use your email to send the newsletter. Unsubscribe any time. See privacy.