Skip to content
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

Peer dependency issue on project using React < 18.2.0 #236

Closed
1 of 11 tasks
lordfpx opened this issue Apr 3, 2024 · 4 comments
Closed
1 of 11 tasks

Peer dependency issue on project using React < 18.2.0 #236

lordfpx opened this issue Apr 3, 2024 · 4 comments
Labels
category: bug Something isn't working

Comments

@lordfpx
Copy link

lordfpx commented Apr 3, 2024

Affected design types

  • figma
  • figspec
  • link
  • image
  • iframe

Describe the bug

On a React project having for peer dependency React >=16.8.0 and Storybook 8.0.5, I've got the following error when running npm i:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @storybook/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   dev react@"^16.8.0" from the root project
npm ERR!   peer react@">=16.8.0" from @emotion/[email protected]
npm ERR!   node_modules/@emotion/use-insertion-effect-with-fallbacks
npm ERR!     @emotion/use-insertion-effect-with-fallbacks@"^1.0.1" from @storybook/[email protected]
npm ERR!     node_modules/@storybook/theming
npm ERR!       dev @storybook/theming@"^8.0.5" from the root project
npm ERR!       5 more (@storybook/addon-designs, @storybook/addon-docs, ...)
npm ERR!   89 more (@figspec/react, @floating-ui/react-dom, @mdx-js/react, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional react@"^18.2.0" from @storybook/[email protected]
npm ERR! node_modules/@storybook/addon-designs
npm ERR!   dev @storybook/addon-designs@"^8.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR!   peerOptional react@"^18.2.0" from @storybook/[email protected]
npm ERR!   node_modules/@storybook/addon-designs
npm ERR!     dev @storybook/addon-designs@"^8.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

How to reproduce the bug?

  1. On a React project having for peer dependencies : react and react-dom >=16.8.0
  2. upgrade project from Storybook 7.x to Storybook 8.x
  3. run npm i

Expected behaviour

All other Storybook addons are working fine except addon-design, the addon should work on every project.

Environment

  • Chrome / Chromium / Chromium based browsers
  • Firefox
  • macOS Safari
  • iOS Safari
  • Samsung Internet
  • Other

Affected versions

8.0.0

Storybook versions

8.0.5

@lordfpx lordfpx added the category: bug Something isn't working label Apr 3, 2024
@lordfpx
Copy link
Author

lordfpx commented Apr 8, 2024

@pocka Yes I know and that's the problem. Looking at the code diff, the React dependency version doesn't seem to be needed and it breaks the addon on projects with older versions.

@JReinhold
Copy link
Contributor

JReinhold commented May 16, 2024

I think you're right @lordfpx, I can't remember why I narrowed the React peer dependency from 16+17+18 to require 18.2. But looking at the block's usage of React I don't see why that would be necessary.

Feel free to open a PR to widen the range again.

@pocka
Copy link
Collaborator

pocka commented May 17, 2024

Fixed in v8.0.1 (#237)

@pocka pocka closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants