storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.73k stars 9.33k forks source link

[Bug]: Module not found: Can't resolve '@testing-library/dom' #21450

Open irfandyj opened 1 year ago

irfandyj commented 1 year ago

Describe the bug

Module not found: Can't resolve '@testing-library/dom' in '/home//projects/oss/storybook-react-design-system/node_modules/@testing-library/user-event/dist' node_modules/@testing-library/user-event/dist/click.js

To Reproduce

  1. Created a React app using create-react-app
  2. Run npx storybook init like in the Guides.
  3. Run npm run storybook, then I got the error logs

System

Environment Info:

  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Binaries:
    Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.2/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
  npmPackages:
    @storybook/addon-actions: ^6.5.16 => 6.5.16 
    @storybook/addon-essentials: ^6.5.16 => 6.5.16 
    @storybook/addon-interactions: ^6.5.16 => 6.5.16 
    @storybook/addon-links: ^6.5.16 => 6.5.16 
    @storybook/builder-webpack5: ^6.5.16 => 6.5.16 
    @storybook/manager-webpack5: ^6.5.16 => 6.5.16 
    @storybook/node-logger: ^6.5.16 => 6.5.16 
    @storybook/preset-create-react-app: ^4.1.2 => 4.1.2 
    @storybook/react: ^6.5.16 => 6.5.16 
    @storybook/testing-library: ^0.0.13 => 0.0.13 

Additional context

Not really it's quite simple.

However it's no problem once you install @testing-library/dom.

RSchultzSorenson commented 1 year ago

I'm getting this on every install of Storybook right now. I've started projects from scratch...but its happening to me. Help!

JanM-cz commented 1 year ago

I'm getting this on every install of Storybook right now. I've started projects from scratch...but its happening to me. Help!

Running npm install --save-dev @testing-library/dom in your project should do the trick.