Yarn 2 package manager: some undeclared dependencies
See original GitHub issueFollow-up for 6.2.9: #14838 These warnings have been fixed pre-6.1.0 in https://github.com/storybookjs/storybook/commit/eaa9410a4d8ea4a35bf9a58f7062842e15a0df78
Describe the bug
yarn install
(Yarn 2 - berry) produces this output. These are warnings only, not blocking:
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @storybook/api@npm:5.2.8 doesn't provide react-dom@* requested by @storybook/router@npm:5.2.8
➤ YN0002: │ @storybook/api@npm:5.2.8 doesn't provide react-dom@* requested by @storybook/theming@npm:5.2.8
➤ YN0002: │ @storybook/html@npm:5.2.8 [b2d93] doesn't provide react@* requested by @storybook/core@npm:5.2.8
➤ YN0002: │ @storybook/html@npm:5.2.8 [b2d93] doesn't provide react-dom@* requested by @storybook/core@npm:5.2.8
➤ YN0002: │ @storybook/client-api@npm:5.2.8 doesn't provide react@* requested by @storybook/router@npm:5.2.8
➤ YN0002: │ @storybook/client-api@npm:5.2.8 doesn't provide react-dom@* requested by @storybook/router@npm:5.2.8
➤ YN0002: │ @storybook/ui@npm:5.2.8 doesn't provide @emotion/core@^10.0.27 requested by emotion-theming@npm:10.0.27
➤ YN0002: │ @storybook/core@npm:5.2.8 [55985] doesn't provide @babel/core@^7.0.0-0 requested by @babel/plugin-proposal-c
lass-properties@npm:7.8.3
➤ YN0002: │ @storybook/core@npm:5.2.8 [55985] doesn't provide @babel/core@^7.0.0-0 requested by @babel/plugin-proposal-o
bject-rest-spread@npm:7.9.6
➤ YN0002: │ @storybook/core@npm:5.2.8 [55985] doesn't provide @babel/core@^7.0.0-0 requested by @babel/plugin-syntax-dyn
amic-import@npm:7.8.3
➤ YN0002: │ @storybook/core@npm:5.2.8 [55985] doesn't provide @babel/core@^7.0.0-0 requested by @babel/plugin-transform-
react-constant-elements@npm:7.9.0
➤ YN0002: │ @storybook/core@npm:5.2.8 [55985] doesn't provide @babel/core@^7.0.0-0 requested by @babel/preset-env@npm:7.
9.6
➤ YN0000: └ Completed in 15.13s
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 23.51s
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 2.42s
➤ YN0000: Done in 3.07m
Fixed in 6.1.0 [EDITED]
The missing peerDeps were added in: https://github.com/storybookjs/storybook/releases/tag/v6.1.0-beta.1 https://github.com/storybookjs/storybook/commit/eaa9410a4d8ea4a35bf9a58f7062842e15a0df78#diff-3e4e211bc6c8ad1c4934045fbab3fac862e23c8e00915e433d09d7eed15a4851R49
Temporary fix for previous versions [EDITED]
Create .yarnrc.yml
next to package.json:
packageExtensions:
"@storybook/addon-actions@*":
peerDependencies:
react-dom: "*"
"@storybook/addons@*":
peerDependencies:
react-dom: "*"
"@storybook/api@*":
peerDependencies:
react: "*"
react-dom: "*"
"@storybook/client-api@*":
peerDependencies:
react: "*"
react-dom: "*"
"@storybook/core@*":
peerDependencies:
"@babel/core": "^7.0.0-0"
"@storybook/html@*":
peerDependencies:
"@babel/core": "^7.0.0-0"
react: "*"
react-dom: "*"
"@storybook/ui@*":
peerDependencies:
emotion/core: "^10.0.27"
To Reproduce Steps to reproduce the behavior:
- Install Yarn 2 berry in a project using storybook
- Run:
yarn
Expected behavior No warning messages:
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 1.33s
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 11.63s
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 8.73s
➤ YN0000: Done in 21.91s
Screenshots
Code snippets Relevant part of package.json
"devDependencies": {
"@babel/core": "7.7.7",
"@storybook/html": "5.2.8",
"@types/jquery": "3.3.33",
"@types/mustache": "4.0.1",
"@types/node-fetch": "2.5.7",
"babel-loader": "8.0.6",
...
}
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
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (6 by maintainers)
Top GitHub Comments
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.
If upgrading a module results in a dependency being met correctly (that is, a rule specified in the
packageExtensions
no longer applies), Yarn will tell you as such, so eliminating that should be fairly straightforward. But, generally, yes, it’s a bit of a mess.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
react-dev-utils
that I’ve raised here: https://github.com/facebook/create-react-app/issues/10902 (But, ah, that repo looks kinda dead to me at the moment, so not sure that one will ever fade haha.)Yarn does also have a
plugin-compat
project which aims to consolidate a lot of thesepackageExtensions
with PRs or Issues raised so that you don’t have to worry about it as much: https://github.com/yarnpkg/berry/tree/master/packages/plugin-compat If a project appears particularly dead (likereact-dev-utils
does to me, for some reason), this can be a way of resolving the issue more globally across Yarn 2 so that you don’t need to specify the extension yourself.