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
Yarn 2 package manager: some undeclared dependencies #11397
Comments
I plan to do a big deps cleaning in 6.1 so I hope it will fix this issue. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
+1 this issue. It's unclear how to resolve these YN0002 warnings. And it's annoying that yarn keeps growling about these warnings.
|
To give some context about a big part of these warnings, they are related to the modularity of Storybook and the fact it has to support a dozen of different framework. One of these frameworks is React but the Storybook app itself is also using React, so to avoid any compatibility issue or dependencies duplication some Storybook packages need to have React as peer dependencies and not regular ones. You can found more details about all that in #13194. Regarding:
It certainly works in many cases but what if the version of package B requested by other packages isn't compatible with the one expected in package A? And what if the dep tree is a bit different because node_modules aren't hoisted the same way? Also related to this subject there is a great article of Yarn lead about transitive peer dep, explaining other tricky situations: https://dev.to/arcanis/implicit-transitive-peer-dependencies-ed0
I'm not a Yarn 2 expert but I think |
This solves my concern. Awesome. Thanks. |
@DavidSabine you might wanna look at |
@gaetanmaisse as for this issue, looks like
Yarn 2:
Can probably fix these errors by specifying the relevant dependency in the |
For completeness, here are all the warnings Yarn 2 is putting out for v6.2.9 app level packages. Common
@storybook/aurelia
@storybook/html
@storybook/marionette
@storybook/vue
@storybook/vue3
|
@spiltcoffee @gaetanmaisse @merceyz can we solve these warnings by simply adding optional peer dependencies for these packages? |
Yep, that seems to be the advice from Yarn: https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency I've also successfully nullified the warnings in my own project for now by using the If you want to test the dependencies are correct, here is a fairly straightforward^ way to test:
^ definition of straightfoward may vary... |
Thank you for the advice. I find Yarn's documentation about packageExtensions really cryptic. I wonder if you'd be able to set me in the right direction. Here's an example of YN0002 messages in my build: So, let's take hash
It's not clear (to me) what this message means. Anyways, I've tried many things... this for example: (Note the addition to .yarnrc.yml; and note the terminal output. Clearly my addition hasn't fixed anything.) Would you be able to tell me what you'd add to packageExtensions config based on the p3a008 (or any other YN0002) message? |
@DavidSabine Sure, can give it a shot. With the YN0002 messages that state So doing the packageExtensions:
# spiltcoffee: also, I did just notice that you've dropped the @scope from this package accidentally. Perhaps that's why you had trouble with this one...
"@endemolshinegroup/cosmiconfig-typescript-loader@3.0.2":
peerDependencies:
typescript: ">=2.7" (preferring to use The other pattern that might occur is denoted with YN0060, which is where the wrong version of a dependency is provided. These ones can be more problematic, but you can still attempt to resolve them via the above process all the same and see what happens. With YN0060s, it might happen that the right version cannot be patched in via the |
Actually, it didn't occur to me I'd need quotes. So I removed the @ symbol to avoid an apparent syntax error. (Again, Yarn's documentation is lacking... almost as much as my familiarity with yaml syntax.) I'll read on... |
I understand now. And I've successfully implemented a few fixes with your help. Thank you. BUT OMG! This is a crazy mess. I can't see how this is sustainable — and I can totally see how this will be everyone's last priority. Here are just a few problems:
Perhaps managing peer requirements are not the responsibility of a consumer of a module, but the responsibility of the module publisher(s). Perhaps some enforcement could be applied by the package manager (npmjs.org?) whereby a module cannot be published if peer requirements are properly addressed in package.json. I don't know the answer to this. Yarn2 is far superior to v1 in this regard. So, I'm not complaining. And I do appreciate all the advice in this thread. |
If upgrading a module results in a dependency being met correctly (that is, a rule specified in the It's not particularly Yarn 2's fault, though - it's just pointing out more clearly that, hey, there are dependency issues here you might wanna do something about. Best thing to do is to try and report these issues to the affected projects. For example, this issue we're commenting on, and another example is for Yarn does also have a |
My understanding is that the entire JS ecosystem is in transition, and this is a symptom. The new scheme is effectively calling out technical debt that millions of packages have accumulated over the past decade. Some of those will fix the problem, some will get replaced by packages that fix the problem (and written in Typescript or whatever the language-du-jour is), and gradually we'll converge on a new ecosystem that plays by the rules. In the meantime we just need to do our best to fix things where possible, and put up with lots of warnings where it's not. |
I've just checked back to see that this commit added the missing peerDependencies: Which was released in https://github.com/storybookjs/storybook/releases/tag/v6.1.0-beta.1 In storybook 6.2.9 there are 2 more missing peerDependencies:
These weren't part of this issue. For clarity I've opened the separate #14838 to track those. |
@DemianX0 will that issue address the other complaints from Yarn 2 about missing dependencies listed here? #11397 (comment) |
Sorry for the late response but yes, that would silence them |
Thanks for mentioning, I've added those too to #14838. |
Follow-up for 6.2.9: #14838
These warnings have been fixed pre-6.1.0 in eaa9410
Describe the bug
yarn install
(Yarn 2 - berry) produces this output. These are warnings only, not blocking:Fixed in 6.1.0 [EDITED]
The missing peerDeps were added in:
https://github.com/storybookjs/storybook/releases/tag/v6.1.0-beta.1
eaa9410#diff-3e4e211bc6c8ad1c4934045fbab3fac862e23c8e00915e433d09d7eed15a4851R49
Temporary fix for previous versions [EDITED]
Create
.yarnrc.yml
next to package.json:To Reproduce
Steps to reproduce the behavior:
yarn
Expected behavior
No warning messages:
Screenshots
Code snippets
Relevant part of package.json
System:
Environment Info:
System:
OS: Windows 8.1 6.3.9600
Binaries:
Node: 12.14.1
Yarn: 2.0.0-rc.27
npm: 6.13.4
npmPackages:
@storybook/cli: ^5.3.19 => 5.3.19
@storybook/html: 5.2.8 => 5.2.8
Additional context
The text was updated successfully, but these errors were encountered: