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

[Bug]: Error: Storybook 7.0+ doesn't support react-scripts@<5.0.0. #22794

Closed
rohanarihant opened this issue May 25, 2023 · 9 comments
Closed
Labels

Comments

@rohanarihant
Copy link

Describe the bug

I am trying to intialize storybook to my React Project, which was created with create-react-app
I updated the react-scripts version to 5.0.1 and my React version is 18.2.0, node 16.20.1.
but still I am facing this issue.
Error: Storybook 7.0+ doesn't support react-scripts@<5.0.0.

can anyone please let me know how to fix this and intall storybook?

To Reproduce

No response

System

mac os

Additional context

No response

@Sidnioulz
Copy link
Contributor

The code that checks this is very explicit and simple, it checks the react-script package's version.

I would suggest you run yarn why react-scripts to make double sure this package is resolved to version 5 and not 4. I would also make sure you don't have a mix of npm and yarn dependencies.

@felixmokross
Copy link

I encounter the same issue. We are on react-scripts@5.0.1.
I also ran npm-why react-scripts, but there is no other version of that package listed.

@felixmokross
Copy link

felixmokross commented May 26, 2023

OK, I found a workaround. I noticed that this code only checks dependencies, but not the devDependencies: https://github.com/storybookjs/storybook/blob/v7.0.17/code/lib/cli/src/generators/REACT_SCRIPTS/index.ts

In our project, we had react-scripts in devDependencies (I think this was the default in the past, might no be this way for newer CRA projects). I temporarily moved react-scripts into dependencies and the storybook init worked fine.

I still think storybook should check devDependencies too though.

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented May 29, 2023

@felixmokross Would you like to open a PR to fix this? It sounds like being a simple fix.

@shilman shilman added cli react cra Prioritize create-react-app compatibility reported good first issue help wanted and removed needs triage labels May 30, 2023
@Sidnioulz
Copy link
Contributor

@felixmokross Would you like to open a PR to fix this? It sounds like being a simple fix.

happy to do it by week's end!

@felixmokross
Copy link

Thanks, @Sidnioulz! For me, it would take some lead time as I am not familiar with the repo.

@WenLonG12345
Copy link

I have the same issue here. Looking forward for a fix! :)

@valentinpalkovic
Copy link
Contributor

Fixed by #22642 and released in v7.1.0-alpha.36

@chadhiremysub
Copy link

I am still having issues with this! I have react-scripts version 5.0.1, react version 18.2.0, and node version 16.20.1.

I have react-scripts in my dev-dependencies. Is this an issue?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants