pnpm "workspace:" protocol not resolving in CI
The workspace: protocol tells pnpm to link a dependency from another package in the same monorepo instead of the registry. If the target package is not covered by pnpm-workspace.yaml, pnpm cannot find it and the install fails.
What this error means
pnpm install fails with "In <project>: "@acme/utils@workspace:*" is in the dependencies but no package named "@acme/utils" is present in the workspace" or a similar "not found in workspace" error.
ERR_PNPM_WORKSPACE_PKG_NOT_FOUND In apps/web: "@acme/utils@workspace:*" is in the dependencies but no package named "@acme/utils" is present in the workspaceCommon causes
The package directory is not listed in pnpm-workspace.yaml
pnpm only treats directories matched by the packages: globs as workspace members; a package outside those globs is invisible to workspace:.
The package name does not match the dependency key
The name field in the target package.json differs from what the dependent references, so pnpm cannot map workspace:* to it.
How to fix it
Include the package in the workspace globs
- Confirm the target package directory is matched by
pnpm-workspace.yaml. - Confirm its
package.jsonnamematches the dependency key exactly. - Re-run
pnpm installfrom the repo root.
packages:
- 'apps/*'
- 'packages/*'Reference the workspace package correctly
Use the workspace protocol with the exact package name so pnpm links the local copy instead of the registry.
{
"dependencies": { "@acme/utils": "workspace:*" }
}How to prevent it
- Keep
pnpm-workspace.yamlglobs in sync with your directory layout. - Match each package
nameto how dependents reference it. - Run
pnpm installfrom the repo root so all workspace members are discovered.