Skip to content

[Bug?]: Yarn change the peer dependencies on his own. #6475

@Pnlvfx

Description

@Pnlvfx

Self-service

  • I'd be willing to implement a fix

Describe the bug

"packageManager": "[email protected]+sha512.f825273d0689cc9ead3259c14998037662f1dcd06912637b21a450e8da7cfeb4b1965bbee73d16927baa1201054126bc385c6f43ff4aa705c8631d26e12460f1"

Installed through corepack

Let's say a library which has 2 peer dependencies,
you do

yarn add -P coraline@https://github.com/Pnlvfx/coraline.git

then yarn will not install it but just add it on the peer dependencies as:

"peerDependencies": {
"coraline": "https://github.com/Pnlvfx/coraline.git"
},

So after that you have to add it on the development dependencies too.

so you do

yarn add -D coraline@https://github.com/Pnlvfx/coraline.git

After doing that the peer dependencies will automatically switch to:

"peerDependencies": {
"coraline": "*"
},

Which of course when you try to install the main library that will try to install the peer, yarn will not find it as it is only on github and not on npm.
So how can yarn find the repo url from just a * character?
The same thing happens with any other peer dependencies that will be automatically converted to "*"

I don't know if it's expected, already the fact that you have to add it in both dev and peer seems to be avoidable for me.
Npm does install them and I don't find the utility of this, but maybe there is.

However great work, sorry for the report, I'm switching back to npm for now, as I'm not able to find a workaround if not changing it manually everytime.

To reproduce

none

Environment

yarn dlx -q envinfo --preset jest

  System:
    OS: macOS 14.6.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
  Binaries:
    Node: 22.7.0 - /private/var/folders/jf/sjh3dgcs1337tv31_17wsyxh0000gn/T/xfs-58355ed6/node
    Yarn: 4.4.1 - /private/var/folders/jf/sjh3dgcs1337tv31_17wsyxh0000gn/T/xfs-58355ed6/yarn
    npm: 10.8.2 - /usr/local/opt/node@21/bin/npm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssues that didn't get attentionwaiting for feedbackWill autoclose in a while unless more data are provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions