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]: Cannot find module react-dom/test-utils #29269

Open
unional opened this issue Oct 2, 2024 · 5 comments
Open

[Bug]: Cannot find module react-dom/test-utils #29269

unional opened this issue Oct 2, 2024 · 5 comments

Comments

@unional
Copy link
Contributor

unional commented Oct 2, 2024

Describe the bug

When upgrading form storybook 8.2.6 to 8.3.4, I got this error.

It is caused by @storybook/react/dist/chunk-OOL6AVF7.mjs:

...
import * as DeprecatedReactTestUtils from 'react-dom/test-utils';

I'm using React 17.

Reproduction link

TBD

Reproduction steps

No response

System

Storybook Environment Info:

  System:
    OS: macOS 14.7
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm <----- active
    pnpm: 9.8.0 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.71
    Safari: 18.0
  npmPackages:
    @storybook/addon-console: ^3.0.0 => 3.0.0 
    @storybook/addon-coverage: ^1.0.4 => 1.0.4 
    @storybook/addon-designs: ^8.0.3 => 8.0.3 
    @storybook/addon-essentials: ^8.3.4 => 8.3.4 
    @storybook/addon-interactions: ^8.3.4 => 8.3.4 
    @storybook/addon-links: ^8.3.4 => 8.3.4 
    @storybook/addon-storysource: ^8.3.4 => 8.3.4 
    @storybook/blocks: ^8.3.4 => 8.3.4 
    @storybook/manager-api: ^8.3.4 => 8.3.4 
    @storybook/react: ^8.3.4 => 8.3.4 
    @storybook/react-vite: ^8.3.4 => 8.3.4 
    @storybook/test: ^8.3.4 => 8.3.4 
    @storybook/test-runner: ^0.19.1 => 0.19.1 
    @storybook/theming: ^8.3.4 => 8.3.4 
    msw-storybook-addon: ^2.0.3 => 2.0.3 
    storybook: ^8.3.4 => 8.3.4 
    storybook-dark-mode: ^4.0.2 => 4.0.2

Additional context

No response

@unional
Copy link
Contributor Author

unional commented Oct 2, 2024

Similar issue in @storybook/core:

// needs to be `react/jsx-runtime.js` in React 17
import { Fragment as b6, jsx as iu } from "react/jsx-runtime";

@shilman
Copy link
Member

shilman commented Oct 3, 2024

Do you a have a reproduction repo you can share? If not, can you create one? Go to https://storybook.new or see repro docs. Thank you! 🙏

@unional
Copy link
Contributor Author

unional commented Oct 3, 2024

Not yet. This is mostly react 17 vs 18 issue. Some of storybook dependency (radux-ui, and storybook/core) is using react 18 specific stuff. So it just won't work with react 17 out of the box.

i.e. storybook 8.3 does not support react 17 anymore, unexpectedly.

I can work around it by patching those two packages locally.

@unional
Copy link
Contributor Author

unional commented Oct 9, 2024

Update: a simple repro doesn't repro the issue. Maybe also related to tsconfig.

However, really not sure why not able to repro, as the import statement is pretty clear shouldn't work.

@edoardo-bluframe
Copy link

Same error here! yarn: 4.5.0, yarn workspaces mono and zero-installs

Just downgraded to 8.2.2 and everything works again!

Maybe let's look into this error?? 😄

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

3 participants