Skip to content

--filter doesn't find root package with pnpm-workspace.yaml #10462

@karlhorky

Description

@karlhorky

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

v10.28.0

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

$ mkdir a
$ cd a
$ pnpm init
Wrote to /Users/k/p/a/package.json

{
  "name": "a",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Karl Horky",
  "license": "ISC",
  "packageManager": "pnpm@10.28.0"
}
$ touch pnpm-workspace.yaml # File presence important, see next section below. Also fails with content of `packages: []` or `packages: ['.']`
$ pnpm --filter a add react # 💥 Fails
No projects matched the filters in "/Users/k/p/a"

However, without a pnpm-workspace.yaml file, the --filter flag finds the package:

$ mkdir a
$ cd a
$ pnpm init
Wrote to /Users/k/p/a/package.json

{
  "name": "a",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Karl Horky",
  "license": "ISC",
  "packageManager": "pnpm@10.28.0"
}
$ pnpm --filter a add react # ✅ Succeeds 
.                                        |   +1 +
Progress: resolved 1, reused 1, downloaded 0, added 1, done
Done in 931ms using pnpm v10.28.0

Describe the Bug

--filter flag doesn't find root package when pnpm-workspace.yaml present

Expected Behavior

--filter flag finds root package when pnpm-workspace.yaml present

Which Node.js version are you using?

v24.13.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions