Skip to content

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

  1. Root Directory = . (repo root):

    • Reads vercel.json from root ✅
    • Runs npm install from root ✅
    • Runs workspace build command ✅
  2. Root Directory = packages/dapp:

    • Still reads vercel.json from root (if present) ✅
    • But runs commands from packages/dapp
    • This causes workspace command to fail

Even with root-level vercel.json, you should still:

  1. Go to: https://vercel.com/kcolbchains-projects/dapp/settings
  2. Settings → General → Root Directory
  3. Set to: . (repo root) or leave empty
  4. Save

Why This Works

  • Root-level vercel.json is 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

CR8 Platform Documentation