Skip to content
Latchkey

Turborepo "could not resolve workspace" in CI

Turborepo needs to know which package manager and workspace layout you use to build its package graph. Without a packageManager field or valid workspaces globs, it cannot resolve the workspace and stops.

What this error means

turbo fails with "could not resolve workspace" or "Could not resolve workspaces" before any task runs.

Turborepo
x could not resolve workspace
  ensure "packageManager" is set in package.json and workspaces are defined

Common causes

The packageManager field is missing

turbo reads the root package.json packageManager field to pick pnpm/npm/yarn. Without it, it cannot resolve the workspace layout reliably.

Workspace globs do not match any packages

The workspaces globs (or pnpm-workspace.yaml) point at paths with no packages, so no members are found.

How to fix it

Set the packageManager field

  1. Add a packageManager field to the root package.json.
  2. Ensure workspaces globs (or pnpm-workspace.yaml) match real package folders.
  3. Re-run turbo so it can resolve the graph.
package.json
{
  "packageManager": "pnpm@9.1.0",
  "workspaces": ["apps/*", "packages/*"]
}

Verify pnpm workspace config

For pnpm, the members live in pnpm-workspace.yaml; make sure its packages globs match the repo layout.

pnpm-workspace.yaml
packages:
  - "apps/*"
  - "packages/*"

How to prevent it

  • Always set packageManager in the root package.json.
  • Keep workspace globs aligned with actual package folders.
  • Commit the correct workspace config for your package manager.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →