Comments (4)
A peer dependency range is only a suggestion. The most important thing about a peer dependency is that it should be a singleton. If there is a version of the package already installed in the workspace, pnpm will use it instead of installing something new. It is really easy to fix it, just install the version of the peer that you want as a direct dependency.
from pnpm.
Thanks for the super quick reply @zkochan!
A peer dependency range is only a suggestion. The most important thing about a peer dependency is that it should be a singleton.
Is this defined anywhere? I don't see any such notes in pnpm docs nor in how npm treats peerDeps — https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies
Also, in large monorepos, this is effectively impossible as some teams can choose to stay on certain versions of the dependency while other teams are free to upgrade. The e.g., here we have the build tool rollup wherein some teams depend on and use rollup@5 via 3rd party packages in the monorepo while some use rollup@4. An upgrade by one team should not break another teams code in such a scenario. And this btw works as expected in pnpm@8.
If there is a version of the package already installed in the workspace, pnpm will use it instead of installing something new.
What's weird is that even when pnpm@9 sees both versions of a peerDep, it chooses the latest one and seems to disregard whatever peerDep suggestion was provided by the package. This again worked as expected with pnpm@8.
Given that aligning versions of the peerDep is not currently possible in this large monorepo I speak of, what other alternatives do I have?
from pnpm.
Also, in large monorepos, this is effectively impossible as some teams can choose to stay on certain versions of the dependency while other teams are free to upgrade.
In that scenario you would need to install a different version of the peer dependency as a direct dependency for the subset of projects that use a different version of the peer dependency. Regardless of this issue, you would need to manually set a peer dependency for one of the groups.
from pnpm.
In that scenario you would need to install a different version of the peer dependency as a direct dependency for the subset of projects that use a different version of the peer dependency. Regardless of this issue, you would need to manually set a peer dependency for one of the groups.
Thank you for the workaround @zkochan!
Any reason why this works as expected in v8 and not in v9 btw?
from pnpm.
Related Issues (20)
- ajv 8.15 caused the problem, I'm not sure if the pnpm up report is a bug or not HOT 2
- peer dependency issue with pnpm deploy
- Can't use specifier for a snapshot dependency in the lock file HOT 13
- Updating to pnpm 9 cause `pnpm install` to look for a workspace dependency on npm HOT 3
- install script throws ETXTBSY ETXTBSY: text file is busy, copyfile '/tmp/tmp.rPcedmGtun/pnpm' -> '/home/capaj/.local/share/pnpm/pnpm'
- v9.2.0 `pnpm --filter=mypackage exec some-command` produces unexpected output HOT 2
- ERR_PNPM_NO_MATCHING_VERSION HOT 1
- Error installing `parcel` (ELIFECYCLE - exit code 126) HOT 3
- `pnpm fetch` fails if at least one injected workspace dependency exists in the monorepo
- Monorepo resolve error when using nextui. HOT 2
- `pnpm update` does not patch update `0.x` production dependencies HOT 2
- Option to ignore carets HOT 2
- Inconsistent install behaviour due to config variable namings in Turkish locale
- pnpm breaks federated modules HOT 1
- strict package manager HOT 4
- Updated must restart HOT 1
- Esbuild post-install failure with pnpm 9.3.0 HOT 4
- Changing the index files name in the package store
- pack & deploy does not include symlinks in packages HOT 3
- sub-dependencies versions are not resolved/updated correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pnpm.