-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
The Catalog feature docs state that the catalog: protocol is supported in peerDependencies. However, using it results in:
➤ YN0057: │ @acme/form: Invalid dependency range for 'zod'
➤ YN0057: │ @acme/ui-next: Invalid dependency range for 'react'
After the error, Yarn silently changes the peerDependencies to * instead of preserving the catalog reference.
To reproduce
Minimal reproduction repo: https://github.com/bengry/yarn-berry-catalog-peer-dependencies-repro
.yarnrc.yml:
nodeLinker: node-modules
enableScripts: false
catalog:
zod: ^3.23.8
catalogs:
react18:
react: ^18.3.1
react-dom: ^18.3.1
react19:
react: ^19.0.0
react-dom: ^19.0.0packages/ui-next/package.json:
{
"name": "@acme/ui-next",
"peerDependencies": {
"react": "catalog:react19",
"react-dom": "catalog:react19"
}
}Run yarn install → error shown above.
Possibly related
This might be related to #6475 where Yarn also changes peerDependencies to * unexpectedly.
Environment
System:
OS: macOS
Binaries:
Node: 24.x
Yarn: 4.12.0 (via corepack)
Additional context
The use case is a monorepo with multiple React versions where packages need to declare peer dependencies on specific catalog-defined versions. In the repro example above - we have a legacy ui package that uses a 3rd party package, stuck on React 18, and we decided to ditch it in favor of a new @acme/ui-next package, that uses React 19. Some apps are already on React 19 and can use @acme/ui-next, while others are still on React 18 and need to use @acme/ui-legacy. In either case - I want to maintain two versions of React in the monorepo - one for v18 and for one for v19, via named catalogs.