Skip to content
Latchkey

Vercel Monorepo "Root Directory" Mismatch - Fix Wrong Package

In a monorepo, Vercel’s Root Directory tells it which app to build. When it points at the repo root (or the wrong package), Vercel installs/builds the wrong thing - and the build fails or deploys the wrong output.

What this error means

A monorepo deploy installs the root workspace, runs the wrong build, or reports a missing build/output because Vercel is rooted at the repo top rather than the app directory. It is deterministic until the Root Directory setting is corrected.

Vercel build log
Error: No Next.js version detected. Make sure your package.json has "next"
in either "dependencies" or "devDependencies".
# (building from repo root instead of apps/web)

Common causes

Root Directory points at the wrong package

The project’s Root Directory is the repo root (or another package), so Vercel reads the wrong package.json and cannot detect the framework or find the app’s build.

Workspace install not configured

Without telling Vercel to install from the workspace root, hoisted dependencies may be missing when building a single package.

How to fix it

Set the Root Directory to the app

  1. In Project Settings → General, set Root Directory to the app folder (e.g. apps/web).
  2. Enable "Include files outside the Root Directory" if the build needs shared workspace packages.
  3. Set the framework preset on that project so detection matches the app.

Pin install/build for the workspace

Use a build/install command that resolves the workspace correctly from the app root.

vercel.json
{
  "installCommand": "npm ci",
  "buildCommand": "turbo run build --filter=web"
}

How to prevent it

  • Set Root Directory per Vercel project to the specific app in the monorepo.
  • Use a monorepo-aware build (turbo/nx) with an explicit filter.
  • Enable including files outside the root when shared packages are needed.

Frequently asked questions

What causes "wrong Root Directory"?
The project’s Root Directory is the repo root (or another package), so Vercel reads the wrong package.json and cannot detect the framework or find the app’s build.
How do I fix wrong Root Directory?
Set the Root Directory to the app

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card