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

Storybook 6.5.9 not working with React 18. #18559

Closed
Vinayaksma opened this issue Jun 24, 2022 · 11 comments
Closed

Storybook 6.5.9 not working with React 18. #18559

Vinayaksma opened this issue Jun 24, 2022 · 11 comments

Comments

@Vinayaksma
Copy link

Describe the bug
In my project with React 18, the version of Storybook and its add-ons with version 6.5.9 are not compatible with react version 18.
Getting failed while installing package.

Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN peer react@"^16.13.1 || ^17.0.0" from @mdx-js/react@1.6.22
npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
npm WARN @mdx-js/react@"^1.6.22" from @storybook/addon-docs@6.5.9
npm WARN node_modules/@storybook/addon-docs

@ldsenow
Copy link

ldsenow commented Jun 29, 2022

I am wondering if storybook is being maintained or not. I found a lot of issues with the 6.5.9 update but I don't see reply from the maintainers.

@nonameolsson
Copy link

I have the same problem :(

@konhi
Copy link

konhi commented Jul 22, 2022

@nonameolsson it might be fixed in v7.0 - which is currently in alpha ✨

https://twitter.com/storybookjs/status/1550126340648476672
image

@ColmBhandal
Copy link

Similar issue for me in 6.5.10:

npm WARN While resolving: react-element-to-jsx-string@14.3.4
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   peer react@"^16.8.4 || ^17.0.0" from react-inspector@5.1.1
npm WARN   node_modules/@storybook/addon-actions/node_modules/react-inspector
npm WARN     react-inspector@"^5.1.0" from @storybook/addon-actions@6.5.10
npm WARN     node_modules/@storybook/addon-actions
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.10
npm WARN   node_modules/@storybook/react
npm WARN 
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN   node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.10
npm WARN     node_modules/@storybook/react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-element-to-jsx-string@14.3.4
npm WARN Found: react-dom@18.2.0
npm WARN node_modules/react-dom
npm WARN   react-dom@"^18.2.0" from the root project
npm WARN   40 more (@chakra-ui/modal, @chakra-ui/portal, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.10
npm WARN   node_modules/@storybook/react
npm WARN 
npm WARN Conflicting peer dependency: react-dom@17.0.2
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN   node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.10
npm WARN     node_modules/@storybook/react

@der-daniel
Copy link

der-daniel commented Aug 15, 2022

See algolia/react-element-to-jsx-string#728

This is already fixed by react-element-to-jsx-string

Maybe just bumping the dep would fix it.

@morganney
Copy link

See algolia/react-element-to-jsx-string#728

This is already fixed by react-element-to-jsx-string

Maybe just bumping the dep would fix it.

  "overrides": {
    "@storybook/react": {
      "react-element-to-jsx-string": "15.0.0"
    }
  }

@shilman
Copy link
Member

shilman commented Sep 5, 2022

Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.30 containing PR #19104 that references this issue. Upgrade today to the @future NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Sep 5, 2022
@cameron-martin
Copy link

cameron-martin commented Sep 14, 2022

@mdx-js/mdx, @mdx-js/react and @mdx-js/loader v1 is still used by the docs addon, which only support React 17. I did try upgrading these to v2, but hit a lot of issues with those packages and a lot of their dependencies being esmodule-only.

These are mentioned in the original post. Can this be re-opened?

@ismay
Copy link

ismay commented Sep 30, 2022

I've tried upgrading to v7 with the suggested npx sb upgrade --prerelease. It's better, but I think one dependency issue still needs to be addressed. According to this comment: #18298 (comment) by @shilman the legacy peerdeps override would no longer be necessary with sb v7. So I've skipped this migration step:

image

After installing the v7 packages I'm still left with these peerdependency conflicts:

image

So it seems that @mdx-js/react still needs to be upgraded. Is that still in the works for storybook v7 @shilman?

@daphnesmit
Copy link

N Could not resolve dependency:
npm WARN peer react@"^16.8.4 || ^17.0.0" from react-inspector@5.1.1
npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
npm WARN react-inspector@"^5.1.0" from @storybook/addon-actions@6.5.13

Copy link
Member

shilman commented Nov 1, 2022

@ismay mdx has been upgraded in v7 npx sb@next upgrade --prerelease

@daphnesmit npm audit warnings are fixed in v7. can't be fixed in v6 due to semver/breaking changes in dependent packages.

NiGhTTraX added a commit to NiGhTTraX/ts-monorepo that referenced this issue Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests