-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 does not work when "react" is version 17 #14807
Comments
Can confirm. Here is my error when using React 17.0.2 (note that it works with React 17.0.1).
|
One issue is that @react/router has a React peer dep that is less than react 17 which is depended on by @storybook/addons |
Do you have a repro repo you can share? I just tried to repro on a fresh CRA and couldn't. And we have tens of thousands of react users, many of which have been using it with 17.0.2 which was published over a month ago. |
Of course, let me share a codesandbox with you You'll find a yarn.lock file along with the rest of the project files.
To reproduce the second issue, where the page is not blank, but the docs have an 'Error Unknown' error, downgrade React to 16.14, test that storybook works well now, and then upgrade to storybook 17.0.2. |
@exapsy try:
|
Sorry for the late response. @shilman you were absolutely right. react-dom also needs an update or the whole page crashes. Good catch! It worked without removing lockfile or node_modules. tldrIf you upgraded react, and you have a storybook error, then you probably forgot to upgrade react-dom as well |
Sorry to reopen, but not sure if this part was addressed here:
I have storybook setup in the root of a NPM 7 monorepo, with React deps to both
Seeing this error when running code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/[email protected]
npm ERR! node_modules/@material-ui/core
npm ERR! @material-ui/core@"^4.11.4" from the root project
npm ERR! peer @material-ui/core@"^4.11.4" from @myscope/[email protected]
npm ERR! packages/my-package-2
npm ERR! 2 more (@myscope/my-package-1, @material-ui/icons)
npm ERR! 29 more (@myscope/my-package-2, @myscope/my-package-1, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm ERR! node_modules/@storybook/api/node_modules/@reach/router
npm ERR! @reach/router@"^1.3.4" from @storybook/[email protected]
npm ERR! node_modules/@storybook/api
npm ERR! @storybook/api@"6.2.9" from @storybook/[email protected]
npm ERR! node_modules/@storybook/addon-actions
npm ERR! dev @storybook/addon-actions@"^6.2.9" from the root project
npm ERR! 1 more (@storybook/addon-essentials)
npm ERR! 8 more (@storybook/addon-backgrounds, ...)
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. Have tried deleting |
I can confirm @digitaltopo's comment. I have the same set of dependencies and see the same error result when running I my case, running I think this issue should be reopened. EDIT: I am not using a monorepo — just a simple single package repo, in case it matters. |
I have the same problem:
{
"name": "repro",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"react": "^17.0.2"
}
} When i try t npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! dev react@"^17.0.2" from the root project
npm ERR! peerOptional react@"^16.8.0 || ^17.0.0" from @storybook/[email protected]
npm ERR! node_modules/@storybook/addon-actions
npm ERR! dev @storybook/addon-actions@"*" from the root project
npm ERR! 8 more (@storybook/addons, react-dom, @storybook/api, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm ERR! node_modules/@storybook/api/node_modules/@reach/router
npm ERR! @reach/router@"^1.3.4" from @storybook/[email protected]
npm ERR! node_modules/@storybook/api
npm ERR! @storybook/api@"6.2.9" from @storybook/[email protected]
npm ERR! node_modules/@storybook/addon-actions
npm ERR! dev @storybook/addon-actions@"*" from the root project
npm ERR! 1 more (@storybook/addons)
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.
npm ERR!
npm ERR! See /home/huchim/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/huchim/.npm/_logs/2021-06-09T20_32_06_389Z-debug.log 🤔 mmm... reach/router#429 |
@huchim – Seems like this is the tracking issue now #14619, which is currently in the v6.4 milestone. Current workaround is using |
Thanks @JoshuaToenyes ... I'll be patiently waiting for the next release... :) |
…book incompatibility with react 17 storybookjs/storybook#14807
It's almost September 2021, the issue is still there. Can someone reopen it please so it does not get lost? |
the middle of October 2021, the same shit |
Describe the bug
When react is version 17.0.2 storybook does not seem to work. Blank white page, and it throws a console error "Error undefined" errors which lead to pretty much nonsensical places inside the bundle and they claim that the root of the problem is
LocationProvider
. No storybook server errors whatsoever, just storybook frontend errors which dont really make much sense (error undefined
as I said).But when I downgrade react to 16.9, it all suddenly works. Of course I assume this is a peer dependency is issue. Could this somehow be solved?
To Reproduce
Use React 17.0.2 with the set of dependencies described below
System
Additional context
So it's deeply related to yarn.lock, which drives me to no conclusion but this being a peer dependency issue.
To be specific, react being version 17.0.2 or 17.* is not the issue alone.
yarn.lock
andnode_modules
and re-installing the node modules withyarn
, reproduces the issue again.yarn upgrade [email protected]
and now storybook is working.yarn upgrade [email protected]
and it also makes storybook work.yarn.lock
andnode_modules
rm -rf ./yarn.lock ./node_modules
, reinstall them withyarn
and it now doesn't work again.Which probably means, React 17.0.2 or React 17 in general uses an upgraded dependency if cleanly reinstalled that storybook is not compatible with. Or I'm not sure what other conclusion to draw from here.
Edit:
Okay so extra details. React 17.^ despite not displaying a blank page after you've upgraded it from React 16.^, still has errors in Docs. Specifically:
But downgrading again to React 16 makes Storybook work again.
Edit 2:
I saw that React 17 does a breaking change with the new JSX Transform.
https://reactjs.org/blog/2020/10/20/react-v17.html
Which dependency name
react/jsx-runtime
also appeared sometimes in the logs randomly during my error messages when runningyarn storybook
. This error happened when I upgraded to React 17 before runningrm -rf ./node_modules ./yarn.lock
So the issue might be because of the new JSX transform React uses.
The text was updated successfully, but these errors were encountered: