Deployment Guide
Vercel Deployment Configuration
Working Configuration
The following vercel.json configuration successfully deploys the homepage-dev monorepo to Vercel:
{
"buildCommand": "turbo build --filter=web",
"outputDirectory": ".next",
"installCommand": "pnpm install --frozen-lockfile"
}Key Configuration Details
-
buildCommand:
turbo build --filter=web- Uses Turborepo to build only the web app and its dependencies
- Runs from the repository root directory
- Automatically handles workspace dependencies
-
outputDirectory:
.next- Must be relative to the app directory context
- CRITICAL: Do NOT use
apps/homepage-web/.nextas this causes path duplication - Vercel already operates in the correct app context
-
installCommand:
pnpm install --frozen-lockfile- Uses pnpm (the project's package manager)
--frozen-lockfileensures reproducible builds
Troubleshooting Notes
Common Issues and Solutions
-
Path Duplication Error:
- Error:
The file '/vercel/path0/apps/homepage-web/apps/homepage-web/.next/routes-manifest.json' couldn't be found - Cause: Using
"outputDirectory": "apps/homepage-web/.next" - Solution: Use
"outputDirectory": ".next"
- Error:
-
Build Directory Not Found:
- Error:
cd: apps/homepage-web: No such file or directory - Cause: Incorrect buildCommand or project structure assumptions
- Solution: Use
turbo build --filter=webfrom repository root
- Error:
-
Dependencies Not Found:
- Error: Various module resolution errors
- Cause: Not using correct package manager or missing lockfile
- Solution: Use
pnpm install --frozen-lockfile
Environment Requirements
- Node.js: >=20
- Package Manager: pnpm
- Build System: Turborepo
- Framework: Next.js 15.4.1
Deployment Process
- Code is pushed to the main branch
- Vercel automatically detects the push
- Runs
pnpm install --frozen-lockfileto install dependencies - Executes
turbo build --filter=webto build the app - Looks for build output in
.nextdirectory - Deploys the built application
Success Indicators
A successful deployment will show:
- ✅ Dependencies installed successfully
- ✅ Turborepo build completes for web app
- ✅ Next.js compilation successful
- ✅ All static pages generated
- ✅ routes-manifest.json found and processed
- ✅ Deployment URL generated
Historical Context
This configuration was refined through multiple iterations:
- Initially failed with various buildCommand approaches
- Path duplication issue was the final blocker
- Working configuration established January 2025