Vercel Root Configuration Fix
Issue
Vercel is running cd packages/dapp && npm install && npm run build instead of using the workspace command, causing build failures.
Solution: Root-Level vercel.json
I've created a vercel.json at the repository root that Vercel will definitely read, regardless of Root Directory settings.
Current Configuration
Root vercel.json (for DApp)
json
{
"buildCommand": "npm run build --workspace=packages/dapp",
"outputDirectory": "packages/dapp/.next",
"framework": "nextjs",
"installCommand": "npm install"
}Package-Level vercel.json (packages/dapp/vercel.json)
This is kept for reference but Vercel will prioritize the root-level config.
How Vercel Reads Configuration
Root Directory =
.(repo root):- Reads
vercel.jsonfrom root ✅ - Runs
npm installfrom root ✅ - Runs workspace build command ✅
- Reads
Root Directory =
packages/dapp:- Still reads
vercel.jsonfrom root (if present) ✅ - But runs commands from
packages/dapp❌ - This causes workspace command to fail
- Still reads
Recommended: Set Root Directory to .
Even with root-level vercel.json, you should still:
- Go to: https://vercel.com/kcolbchains-projects/dapp/settings
- Settings → General → Root Directory
- Set to:
.(repo root) or leave empty - Save
Why This Works
- Root-level
vercel.jsonis always read by Vercel installCommand: "npm install"installs from root (workspace dependencies)buildCommand: "npm run build --workspace=packages/dapp"works from root- Dependencies are hoisted correctly in monorepo
Next Deployment
After this change is pushed:
- Vercel will read the root
vercel.json - Build should succeed
- If it still fails, verify Root Directory is set to
.in dashboard