-
Notifications
You must be signed in to change notification settings - Fork 27.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
Storybook build fails with cannot find module error #55620
Comments
I believe this is the same issue as the one reported in the following Storybook issue: |
Storybook maintainer here – that's right @MUJI-Okubo, thanks for linking the issue. |
This got fixed with @storybook/nextjs@7.4.3, but now I get => Failed to build the preview
Module not found: Error: Can't resolve 'react-dom/test-utils' in './node_modules/@testing-library/react/dist/@testing-library'
ModuleNotFoundError: Module not found: Error: Can't resolve 'react-dom/test-utils' in './node_modules/@testing-library/react/dist/@testing-library' |
as per this comment, this is not a Next.js issue, so closing. @yannbf do you have |
Hey @balazsorban44! For sure, we are planning to set up a prerelease sandbox for Next.js, so things like this are caught faster. It would be fantastic if there was a development layer we could hook into, instead of reimplementing each feature support, but that's what we can do right now, with the risk of having breakages like this between minor or patch releases. Maybe in the future things can be smoother! @DotCoyote can you continue this discussion here, and please add a reproduction so we can take a look? storybookjs/storybook#24234 |
Hey @DotCoyote, I'm facing the exact same issue after upgrading to |
No, I'm not able to use storybook with this bug in my project atm |
coming here to say I too, experience this... |
Same thing here: Interestingly this happens either when upgrading Next.js to 13.5 or when upgrading Storybook to 7.4.5 (and when upgrading both at the same time as well), so I don't think that this is purely a Storybook issue. @balazsorban44 can we reopen this issue to track it on the Next.js side until we figure out what's happening? |
Upgrading to the latest next and storybook resolved the issue. |
upgrade storybook to 7.4.5 and next to 13.5.3 fixed my issue |
I'm still facing the issue with: |
Indeed what @sanalpanicker mentioned worked by upgrading all (addon) dependencies including Storybook to (pinned) 7.4.3 worked while I was using next@13.5.2. Another thing to watch out for is context provider and link router import hell in stories. At least storybook builds! |
Are you guys referring to the issue with the As @gvillenave pointed out, upgrading to
|
Correct, the |
I'm having the same issue as @Jonathan-Valladares upgrading doesn't work |
@gvillenave @Jonathan-Valladares @DotCoyote did you get anywhere with the I wonder if we all have something specific in our Next config, Storybook config, or @yannbf I don't suppose you have any ideas what might cause this Next x Storybook issue? I'm seeing it even on Next 13.5.4 and Storybook 7.5.0-alpha.3. |
@philwolstenholme if you provide a reproduction link I'm happy to take a look. |
I am also having the same issue as @philwolstenholme - the |
@telriot the Next and Storybook version on https://storybook.new is working fine, so I think our issue might be related to something like:
Presumably you, me, and the other people affected are all using the same plugin/copy-pasted config snippet etc |
@philwolstenholme SO, i ran the same config for storybook on 2 different projects in a monorepo, one works, one fails (also: they have the same deps for react testing library / react dom). UPDATE: |
Thank you, @telriot! Your suggestion pointed me in the right direction. My problem stemmed from this line:
I managed to resolve it by changing to:
Thanks for the tip on the alpha version; it certainly provides clearer error messages! |
Great to know @Jonathan-Valladares! Storybook provides an eslint-plugin which actually has a rule to avoid users doing exactly what you found, with the wrong import of testing-library. You should check it out! |
Ah that's interesting… I've just checked and I am importing I'll try using an alpha and see if it gives a clearer error message. I've just installed the ESLint plugin, thanks for that tip Yann :) |
I found the root cause of the error below: The default Webpack configuration of Storybook resolves
I think the right fix here would be to add a |
For me the issue was that we were wrapping our stories with a big 'context provider for tests' component, and we'd added a |
in my case the error line was I am using latest version of storybook and nextjs = (13.5.2) so the error was that while loading storybook, we were trying to load testing library, while storybook also has its reference created for testing library |
The issue is resolved: storybookjs/storybook#24453. The fix will be released soon. |
@valentinpalkovic that might resolve the issue with |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/tnyo43/storybook-next13-5-1
To Reproduce
pnpm install & pnpm storybook_build
, then you will find that it failsgit revert HEAD
pnpm install & pnpm storybook_build
, the build process should successThis is the message of the error that occurred when executing with v13.5.1.
Current vs. Expected behavior
The build process should success with the latest version, but not at the moment
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 Binaries: Node: 18.15.0 npm: 9.5.0 Yarn: 1.22.19 pnpm: 8.2.0 Relevant Packages: next: 13.5.1 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
No response
The text was updated successfully, but these errors were encountered: