-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Cannot find module 'react/package.json' #13665
Comments
@xiangxiong running If you want to bootstrap a React app + Storybook you can do the following: npx create-react-app <YOUR_APP_NAME>
cd <YOUR_APP_NAME>
npx -p @storybook/cli sb init
npm run storybook I let you close this issue if my answer solves your problem, otherwise, I let you provide a repro repo. |
@gaetanmaisse FYI we're recommending this, which is functionally equivalent to your recommendation, but shorter/simpler:
|
The problem remains,use npx sb init |
Check if you have added react as part of peer dependencies. It has to be there in dependencies also. |
This gets rid of a typescript warning issue in a dependency, and also nice to keep this up to date. After upgrading storybook, I ran into an issue where storybook expects React to be installed. We do not want to ship react with this library, but instead rely on the caller's copy of react. I noticed that chakra-ui installs react as a dev dependency. I wager that this is for their storybook support as well. See https://github.com/chakra-ui/chakra-ui/blob/8a8b7be6233aa2be717a733bbcf012cfcad29516/packages/button/package.json#L58 Looking at storybook issues, I found storybookjs/storybook#13665 where someone points out that react must be a dev dependency in order for storybook to work properly.
Also need to have react-dom installed as a dev dependency. |
I can't install react-dom as a dev dependency. First of all, that defeats the point of using preact... because then storybook doesn't use preact. So what would be the point? Finally, I am using nextjs, and it requires the aliasing of react and react-dom like so:
|
Reopen this issue because this it is not fixed |
Hi guys just checked again if anyone facing the error make sure to run :
|
In my case, i.e. |
In my case, with a simple storybook setup, reinstalling node_modules with |
I'm having this issue on yarn 3.2.4. I tried installing sb via I think the issue here is yarn 3... if something is actually looking for the file ( |
building software that no one will use, react-dom is missing and storybook team does not give a *** adding this tiny step |
@viveleroi did you try adding a dev dependency on |
Yes that’s automatic through the init program.
|
I'm having this issue on an HTML based project. i don't want to have to install react... is that possible? |
Describe the bug
npm run storybook Cannot find module 'react/package.json'
To Reproduce
Steps to reproduce the behavior:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: