question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Yarn 2 package manager: some undeclared dependencies

See original GitHub issue

Follow-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:

  1. Install Yarn 2 berry in a project using storybook
  2. 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:closed
  • Created 3 years ago
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
shilmancommented, May 4, 2021

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.

2reactions
spiltcoffeecommented, May 4, 2021

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 these packageExtensions 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 (like react-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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration | Yarn - Package Manager
A step-by-step and in-depth migration guide from Yarn 1 (Classic) to Yarn 2 (Berry).
Read more >
Yarn not recognizing built in package? - Stack Overflow
I am now trying to migrate to Yarn 2 with PnP and in that, ... And the doctor found that this history is...
Read more >
Introducing Yarn 2 ! - DEV Community ‍ ‍
If you just want to start right now with Yarn 2, check out the ... to any package) tried to access // a...
Read more >
npm, pnpm, and Yarn | WebStorm Documentation - JetBrains
Choose a project package manager. With WebStorm, you can choose whether to use npm, Yarn, Yarn 2, or pnpm in a project.
Read more >
Manage build dependencies | Netlify Docs
NETLIFY_USE_YARN : undefined by default. If true , Netlify will install and run Yarn. · YARN_VERSION : variable that defaults to the version...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found