pnpm icon indicating copy to clipboard operation
pnpm copied to clipboard

Overrides seem to not work on peer deps

Open zkochan opened this issue 1 year ago • 4 comments
trafficstars

          > > In [DimensionDev/Maskbook@4f5f116 (#11571)](https://github.com/DimensionDev/Maskbook/pull/11571/commits/4f5f1161f8e01f6253957fffcf1428b2984cab2d) (Good state), if you search "[email protected]" you'll find nothing, but if you change package.json to "packageManager": "[email protected]", and run pnpm install, now the lockfile contains "[email protected]" and the app is broken.

I you want to override the version of react, use an override

img

Yes! I'm using it but still have the problem. Just tried again with 9.0.2

Originally posted by @Jack-Works in https://github.com/pnpm/pnpm/issues/7934#issuecomment-2061884301

zkochan avatar Apr 17 '24 18:04 zkochan

Can confirm this is an issue. Had to revert back to v8 for now unfortunately. Happy to provide anything that might be of assistance!

hmnd avatar Apr 25 '24 02:04 hmnd

After hours of debugging this issue, I can confirm this is definitely the case.

Here's my case:

In the monorepo root package.json:

  "pnpm": {
    "peerDependencyRules": {
      "allowedVersions": {
        "@aws-cdk/integ-tests-alpha>aws-cdk-lib": ">=2.100.0",
        "@aws-cdk/app-staging-synthesizer-alpha>aws-cdk-lib": ">=2.100.0"
      }
    }
  },

In the package in question:

  "devDependencies": {
    "@aws-cdk/app-staging-synthesizer-alpha": "2.138.0-alpha.0",
    "@aws-cdk/integ-runner": "2.138.0-alpha.0",
    "@aws-cdk/integ-tests-alpha": "2.138.0-alpha.0",
    "aws-cdk": "2.100.0",
    "aws-cdk-lib": "2.100.0"
  },
  "peerDependencies": {
    "aws-cdk-lib": "^2.100.0"
  },

Error raised when running like this: pnpm i --no-frozen-lockfile --reporter ndjson (also see #7978 why)

    "packages/aws-cdk-my-pacakge": {
      "bad": {
        "aws-cdk-lib": [
          {
            "foundVersion": "2.100.0",
            "resolvedFrom": [],
            "parents": [
              {
                "name": "@aws-cdk/app-staging-synthesizer-alpha",
                "version": "2.138.0-alpha.0"
              }
            ],
            "optional": false,
            "wantedRange": "^2.138.0"
          },
          {
            "foundVersion": "2.100.0",
            "resolvedFrom": [],
            "parents": [
              {
                "name": "@aws-cdk/integ-tests-alpha",
                "version": "2.138.0-alpha.0"
              }
            ],
            "optional": false,
            "wantedRange": "^2.138.0"
          }
        ]
      },

moltar avatar Apr 27 '24 11:04 moltar

Can replicate.

gajus avatar May 17 '24 23:05 gajus

We're using v8.15.0 and neither pnpm.overrides nor pnpm.peerDependencyRules seems to adjust the lockfile. When we used resolutions, the expected change to the lockfile did occur.

kylemh avatar Jun 23 '24 16:06 kylemh