pnpm installation of peerDependencies did not select the correct version

253 views Asked by At

pnpm version: 7.32.0

This is a reproducible demo: demo

description:

  1. In the demo project, for some reasons, I have to use [email protected], and there is also a package called @wuerkang/test_package.
  2. @wuerkang/test_package is the test package I created, which depends on ink and ink-spinner. Both packages have react as a peer dependency, and ink-spinner also has ink as a peer dependency. I expect them to use [email protected]
/* package.json of @wuerkang/test_package */
{
  "name": "@wuerkang/test_package",
  "dependencies": {
    "react": "17.0.2",
    "ink": "3.2.0",
    "ink-spinner": "4.0.3"
  }
}

Expected behavior:

Install [email protected] in the project's root directory, and ink package can correctly reference [email protected]

Actual behavior:

When auto-install-peers=false, the installation result meets expectations; but when auto-install-peers=true, ink incorrectly references [email protected] instead of 17.0.2. At the same time, a warning log appears in the console:

.
└─┬ @wuerkang/test_package 1.0.5
  └─┬ ink 3.2.0
    └─┬ react-reconciler 0.26.2
      └── ✕ unmet peer react@^17.0.2: found 16.9.0

question:

Is there a way to automatically install unmet peers?
Is it true that we have no control over the versions of peerDependencies for deeply nested packages?
Or how to set configuration in the above scenario to meet my needs?
Looking forward to your answer,thanks!

0

There are 0 answers