When your Vercel CLI decides to have an existential crisis at 3am and nothing works, here are the nuclear options that actually fix shit.
Delete Everything and Start Over
Sometimes the CLI gets corrupted and no amount of troubleshooting helps. Nuclear option:
## Nuke the CLI
npm uninstall -g vercel
npm cache clean --force
npm install -g vercel@latest
## Nuke your local config
rm -rf ~/.vercel
rm -rf .vercel
## Start fresh
vercel login
vercel link
This takes 5 minutes and fixes 80% of weird CLI issues. Should be your first move when debugging gets frustrating.
The Authentication Death Spiral
CLI authentication is broken in weird ways. If you're getting random auth errors:
- Clear browser cookies for vercel.com (the OAuth flow caches shit)
- Use incognito mode for the login redirect
- Try a different browser (seriously, Chrome vs Firefox matters sometimes)
The CLI opens your default browser, but if that browser has conflicting sessions, everything breaks. I've seen this kill deployments for entire teams.
OK, auth rant over. Now about environment variables - they're probably why your deployment is failing...
Environment Variable Hell
Your local .env.local
works, but production fails with undefined variables. Common gotchas:
Preview vs Production environments - Vercel has separate env vars for each. Set them in the dashboard under Settings → Environment Variables. Check all three boxes: Development, Preview, Production.
Variable naming - Vercel strips NEXT_PUBLIC_
prefixes in the dashboard but expects them in your code. This is confusing as fuck:
## In dashboard: API_KEY=abc123
## In code: process.env.NEXT_PUBLIC_API_KEY (undefined)
## Fix: Name it NEXT_PUBLIC_API_KEY in dashboard too
Quotes matter - Don't quote strings in the Vercel dashboard:
## Wrong in dashboard
DATABASE_URL=\"postgresql://user:pass@host/db\"
## Right in dashboard
DATABASE_URL=postgresql://user:pass@host/db
The dashboard adds its own quotes, so you end up with double quotes and everything breaks.
Build Cache Corruption
Your builds suddenly take 15 minutes instead of 2? Cache corruption. Fix it:
## Force fresh build
vercel --force --no-cache
Or nuke the cache from the dashboard: Project Settings → General → Clear Build Cache.
Vercel's build cache gets corrupted more often than they admit. We've had monorepos where the cache pointed to the wrong package.json and everything exploded.
Node Version Hell
September 1, 2025 - Node.js 18 was deprecated. If your builds started failing around then, check your package.json
:
{
\"engines\": {
\"node\": \"20.x\"
}
}
Or your vercel.json
:
{
\"functions\": {
\"pages/api/**/*.js\": {
\"runtime\": \"nodejs20.x\"
}
}
}
The error messages for Node version mismatches are cryptic as hell:
Error: Cannot find module '/var/task/node_modules/...'
This usually means Node version mismatch, not missing dependencies.
The Monorepo Nightmare
If you're in a monorepo, Vercel CLI gets confused about which package.json to use. Set the root directory:
vercel --cwd packages/frontend
Or in vercel.json
:
{
\"buildCommand\": \"cd packages/frontend && npm run build\",
\"installCommand\": \"npm install --prefix packages/frontend\"
}
Monorepos are where the CLI shows its age. The framework detection fails and you'll spend hours debugging build paths.
When Functions Return 500s
Your API routes worked locally but return 500 in production. Check the function logs in the Vercel dashboard under Functions tab. Common issues:
Memory limits - Default is 1024MB. If you're processing large files or doing ML stuff, increase it in vercel.json
:
{
\"functions\": {
\"pages/api/**/*.js\": {
\"memory\": 3008
}
}
}
Timeout issues - Default is 10 seconds on Hobby, 60 seconds on Pro. Long-running operations will timeout. Consider background jobs or increase limits.
Missing dependencies - Your function imports something that's not in production. Check your package.json
dependencies vs devDependencies.
The Preview URL Trap
Preview URLs use production environment variables by default, which is insane. If your feature branch breaks production data:
- Create separate staging environment in your database
- Set STAGING_DATABASE_URL for preview deployments
- Use branch-specific env vars in the dashboard
Or just accept that preview URLs will occasionally fuck up real data because Vercel's default behavior is terrible.
Bandwidth Bill Shock Recovery
You deployed a simple blog and got a $300 bill because your image gallery hit the front page of Reddit. Immediate damage control:
- Delete large images from your repo
- Move images to Cloudflare R2 or AWS S3
- Set spending alerts in your billing settings
- Consider switching to Cloudflare Pages if this happens again
The billing shock is real. I've seen $1,200 bills from 2TB of image traffic in 48 hours. Vercel doesn't warn you until it's too late.
Last Resort: Contact Support
If none of this works, Vercel support is actually decent if you're on a paid plan. But come prepared:
- Deployment URL that's failing
- Full error logs from the dashboard
- Steps you've already tried (they'll ask anyway)
- Team and project name (they need this for debugging)
Don't contact support with "my build is broken" - give them actual error messages and context.
The CLI works great until it doesn't. When debugging gets frustrating, nuke everything and start fresh. It's usually faster than finding the root cause of whatever weird state the CLI got itself into.