Skip to content

Fix pnpm workspace installs missing dependencies of workspace dependencies - #23754

Open
smaugho wants to merge 3 commits into
pantsbuild:mainfrom
smaugho:fix/pnpm-workspace-install
Open

smaugho wants to merge 3 commits into
pantsbuild:mainfrom
smaugho:fix/pnpm-workspace-install

Conversation

@smaugho

@smaugho smaugho commented Nov 4, 2026

Copy link
Copy Markdown

Fixes #23752.

Problem

In a pnpm workspace, installing the node package for a target only installed that package's own dependencies. When the package depends on another workspace package, that package's dependencies were left uninstalled, so code importing through it failed at runtime (e.g. Cannot find package '@invented/leaf').

Change

When Pants installs a pnpm workspace member, it now selects the member together with its dependencies, using pnpm's <package>... filter, instead of the member alone.

  • Only the pnpm install path changes. Ordinary commands, npm and yarn, root environments and single-package projects keep their current selectors.
  • Release note added in docs/notes/2.34.x.md.

Tests

  • New regression test: a workspace reader -> contract -> leaf. It installs through the real rules and runs Node. On current main without the fix it fails (Cannot find package '@invented/leaf'); with the fix Node prints 42.
  • Scope cases cover installation versus ordinary commands across pnpm, npm and yarn, and member, root and single environments.
  • Verified on main 05181fa with the native engine built locally: 25/25 tests in install_node_package_test.py and nodejs_project_environment_test.py, lint, MyPy, build-support/githooks/pre-push and pants --changed-since=HEAD fmt all pass.

AI disclosure

This PR was written primarily by Claude Code; I reviewed and tested it.

@smaugho
smaugho force-pushed the fix/pnpm-workspace-install branch from 520625d to cf8a6ff Compare November 5, 2026 18:52
@smaugho
smaugho force-pushed the fix/pnpm-workspace-install branch from cf8a6ff to b2e4dbe Compare November 6, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

javascript: pnpm workspace install does not install a dependency workspace's own dependencies (--filter <pkg> instead of <pkg>...)

1 participant