Static Assets Returning 404 After Deployment
Static assets such as images, fonts, PDFs, and other files that work perfectly in local development return 404 errors after deploying your v0-generated Next.js app to Vercel. The public folder contents are not being served, or asset paths are resolving incorrectly in production.
This commonly happens because v0 generates references to assets using relative paths that work in development but break when the application is deployed under a base path or when the build output restructures the file hierarchy.
Fonts loaded from the public folder may also fail to load, causing layout shifts as the browser falls back to system fonts, and favicon or Open Graph images referenced in metadata may return 404 in production.
Error Messages You Might See
Common Causes
- Case sensitivity mismatch — local filesystem (macOS/Windows) is case-insensitive but Vercel's Linux filesystem is case-sensitive
- Relative paths instead of absolute — using './images/logo.png' instead of '/images/logo.png' breaks after deployment
- Assets outside public folder — files placed in src/ or app/ directories are not served statically
- Build output not including assets — .gitignore or .vercelignore excluding necessary static files
- Base path not prepended — when using basePath in next.config.js, asset URLs need the prefix
How to Fix It
- Use absolute paths — reference all static assets with leading slash:
/images/logo.pngnot./images/logo.png - Check case sensitivity — ensure filenames match exactly including capitalization: Logo.PNG vs logo.png
- Verify public folder structure — all static assets must be in the /public directory at the project root
- Check .gitignore — ensure static assets are not being excluded from version control and deployment
- Use next/font for fonts — replace public folder fonts with next/font/google or next/font/local for automatic optimization
- Test with production build — run
next build && next startlocally to catch asset issues before deploying
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
Why do my assets work locally but not on Vercel?
Most likely a case sensitivity issue. macOS and Windows filesystems are case-insensitive, but Vercel runs on Linux which is case-sensitive. Check that filenames match exactly.
Where should I put static files in Next.js?
Place them in the /public directory at your project root. They are served from the root URL: /public/logo.png is accessible at /logo.png.
How do I serve files from a subdirectory?
Create subdirectories inside /public. For example, /public/downloads/guide.pdf is accessible at /downloads/guide.pdf.