microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.83k stars 592 forks source link

[rush] pnpm fails to properly find peer dependencies #3034

Open ivy1201 opened 2 years ago

ivy1201 commented 2 years ago

Steps to repro:

Create a new rush repo with rush init . Set strictPeerDependencies to false. Create a local package (e.g., B) with a peerDependency (e.g., C@*) Create another local package (e.g., A) which depends on both B and C@1.1.1_alpha

and the package C's remote package version with latest tag is 1.1.1

Run rush update, and find the structure of A's node_module is A └── node_modules ├── C@1.1.1_alpha ├── B │ ├── node_modules └──C@1.1.1 i am confused why C's version under B is 1.1.1, i want to use the same version as 1.1.1_alpha

If this is a bug, please provide the tool version, Node.js version, and OS. Tool: rush / pnpm Tool Version: rush@5.53.0, pnpm@6.14.6 Node Version: 15.14.0 Is this a LTS version? yes Have you tested on a LTS version? yes OS: macOS 10.15.5 Catalina

dmichon-msft commented 2 years ago

What's the devDependency version listed for C in B? That's the version that will get installed as the dependency of B, unless you are using one of the latest versions of pnpm and have opted into its fancy new hardlinking of local packages to support custom peer configurations.

ivy1201 commented 2 years ago

@dmichon-msft C is not listed in B's devDependency, it is as a peerDependency, i am confused why it alway find the version with the latest tag

dmichon-msft commented 2 years ago

Could you link a demo repo? This is much easier to answer when I can point to the content of package.json and how they impact the lockfile generated during rush update.