-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling dependencies of dependencies and their resolution #2763
Comments
For the record, I tried to use the resolutions field to force the version of the concerned dependencies, but they are just ignored… |
It is possible to work around this by running yarn, manually editing yarn.lock, deleting node modules, and rerunning yarn. Not fun. |
Was able to get this running with what @kylecordes said as well |
i've dealt with this too unfortunately. my solution has been to simply regenerate the lock file :/, even if it means rm'ing it and regenerating it. i install my dependencies |
@moimikey erasing the
So we have to change it by hand to
|
@mattma no it wasn't, or at least not the problem underlined here in this issue, see my comment on the angular-cli thread. But after some thought, I'm not sure it make really sense to consider this situation a "bug"... anyway I will leave this decision to yarn dev. |
@victornoel thanks for the updates. I agree with you. |
@mattma is there a separate issue open for "resolutions bug" that I could subscribe to? I searched through the list but couldn't find any. Perhaps this is the right one to subscribe to? Thank you! |
Shoot. I meant to ask above question to @victornoel ^^ |
@cansin sorry, I saw it, but anyway I'm not sure how to answer that… what's your objective here? You just want to know about "resolutions bug" in general? |
@victornoel I have a
But I still end up with a
But in my case yarn silently ignores the resolution and decides to resolve a sub jquery dependency with a concrete |
Wait for a second, I was right about asking the question to @mattma in the first place. As they claimed the issue is fixed, and not you @victornoel . Sorry about the confusion. Anyway @mattma care to comment re: above? |
@cansin a simple fix is to edit For example, in my project I use Typescript (v2.3.1) but sub dependencies relies on others Typescript versions. No matter what I try to do in
I just edit it by hand like that :
So yes, it ain't perfect solution to edit |
@maxime1992 thanks for the suggestion. Though since I am working with a relatively large team (>80 eng.), I cannot manually keep |
Indeed it's far away from a perfect solution but it's the only fix I could come up with right now ... Of course, let's hope it's fixed soon because it's a real problem ;) |
Unfortunately, this workaround does not work anymore with yarn 0.24.x since #2629 was solved with #3106... @bestander this issue is becoming critical now, because it's really complex to handle manually situations where the resolved dependencies are incorrect (because of faulty dependencies package.json). My use case is the following: |
And for the record, it's not always for convenience reasons that this happens, the same happened during the transition between angular v2 to v4, when many dependencies forced the dependency to angular 2 even though v4 was API compatible with v2. |
If a dependency depends on |
@bestander we can't ask every maintainer to do that nor do it ourselves. |
Maybe I don't understand it right but looks like that Yarn is resolving the dependencies correctly according to semver. |
@bestander we want the same thing that It's a feature used a lot in maven for example. Sometimes you use libraries that are not maintained anymore and that depends on buggy versions and the only choice you have is to force a version for one of its dependency. Something like a resolve field where you can enforce a given version for a given dependency's dependency would be such an answer (and I believe that's what |
(by the way, it's more a feature request than a bug, except if |
Ok, I understand it now. |
Anecdotally, many. npm.js contains 350,000 packages. I wonder what percentage of them are maintained and have up to date dependencies?
Anyone who needs to can fork package A, creating package A2 with various fixes and update. Unfortunately, convincing the maintainers of package B, if it is maintained at all, to change their dependency to the new A2 fork, might or might not be possible. |
I wonder the same, it is possible to fetch all package metadata from npm couchdb and do a query, so actual number does not need to be a speculation. |
what is simpler? override the version of a dependency from your project or fork another project, change the dependency, fork all the dependencies of your project depending on the forker dependency and do the same, and so on, publish all of that to npm and then release you project with the forked dependency? :) This actually raises the question of propagating overridden dependencies to project that depends on your project, but I think that for now it's out of the feature request. Concerning your comments @bestander, it's not only about unmaintained dependencies, that was just one use case. Actually I'm a bit out of arguments because I'm surprised that the feature is so difficult to be considered useful ^^ If needed I will take the time to find some more :) |
Thanks for sharing your point, @victornoel, those are the sad parts of a decentralized dependency ecosystem that we have. My concern was that this looks like a patch that masks a symptom of a serious issue and every one in the same situation has to apply this patch instead of fixing the cause. However I am on your side now :) This would allow replacing, for example typescript |
@bestander so to be sure I understand (before I try to make an RFC, I'm not so sure I will be able to help for implementation though ^^), you propose to be able to express, in the Something like that: "devDependencies": {
"@angular/cli": "1.0.3",
"typescript": "2.2.2",
"more dependencies..."
},
"resolutions": {
"typescript@>=2.0.0 <2.3.0": "typescript@2.2.2"
}, What I don't like with this is that I have to know that I feel that (but it's only based on my maven experience and current needs, I may be missing some other use cases) it would be nicer to be able to say something like this in the package.json: for a given dependency (e.g., angular-cli), typescript should have the spec Something like that (note that then it is necessary to differentiate dev and non-dev dependencies I think...): "devDependencies": {
"@angular/cli": "1.0.3",
"typescript": "2.2.2",
"more dependencies..."
},
"devResolutions": {
"@angular/cli": {
"typescript": "2.2.2"
}
}, An alternative (very similar to how maven works, and also how Something like that: "devDependencies": {
"@angular/cli": "1.0.3",
"typescript": "2.2.2",
"more dependencies..."
},
"resolutions": {
"typescript": "2.2.2"
}, The last one is the simplest in terms of expressiveness AND understanding. What do you think? |
Propose in an RFC the one you think will be the best for most people. Then others from the community can comment and we'll agree on something. |
ok, thanks! |
@victornoel @bestander thanks for trying to figure this out. @victornoel I agree that your last proposal makes the most sense. i.e.
resolving to |
@cansin yep, I think am going for this one, and it goes well with the current flatten behaviour, so it's more of an improvement than a complete new feature, so less chance to confuse people and maybe easier to implement. |
Looking forward, when maintaining OSS builds in React Native I remember quite a few situations when a breaking patch in a deep dependency broke React Native for everyone and there was no other way out except for begging the dependency maintainers to release a new patch. |
RFC submitted: yarnpkg/rfcs/pull/68 :) |
Hello, Setup So we have a package fork as a top-level dependency.
Expected behavior:
Actual behavior:
So my question: is this a related problem or do I need to submit another issue report? Thanks. |
@e1himself submit another bug report :) |
Closing since the main request seems to be resolved with #4105. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
This has been made visible via angular/angular-cli#4611 and angular/angular-cli#4787.
Basically, there are some dependencies to:
"@angular/cli": "1.0.0-beta.32.3"
(as adevDependencies
)"@angular/compiler" ">=2.3.1 <5.0.0"
"@angular/compiler": "4.0.0-beta.8"
(as adependencies
)The problem is that yarn resolves
@angular/cli
dependency to"@angular/compiler" "2.4.8"
which creates problems with angular-cli.If the current behavior is a bug, please provide the steps to reproduce.
See angular/angular-cli#4787 (comment):
What is the expected behavior?
I would either expect yarn to:
"@angular/compiler": "4.0.0-beta.8"
is explicitly expressed in the package.json, it should use it also for dependencies dependencies if it matches (which is the case here).Please mention your node.js, yarn and operating system version.
yarn 0.20.3, node 6.10.0, latest archlinux
The text was updated successfully, but these errors were encountered: