question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module '@redwoodjs/testing/web' when running Storybook

See original GitHub issue

Having followed the tutorial up to chapter 5, i am getting this error in the dev console when i run yarn rw storybook:

grafik

All of the stories just render a blank page in the UI, the Cells and Pages are not even listed.

I am unsure whether this is typescript related or not – from my experience any typescript errors are gracefully handled when compiling to JS, and this seems to be a webpack error message.

However, when i run the js-based https://github.com/redwoodjs/redwood-tutorial there is no such error – the dependencies listed in package.json are identical to my project, which you can check out here: https://github.com/Philzen/redwoodblog-tutorial-typescript

Any ideas what’s going on here greatly appreciated.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

10reactions
dac09commented, Apr 7, 2022

OK FOUND ISSUE! This solves both issues.

Tried a bunch of theories, but pulling on the thread from this issue, it looks like this happens when storybook for some reason picks webpack 4 accidentally (extrapolating from this thread) - When there are multiple versions of webpack 5 (in our case, redwood is using 5.70.0, but storybook wants 5.71.0) - see this output from yarn why

gitpod /workspace/redwoodblog-tutorial-typescript (main) $ yarn why webpack
├─ @redwoodjs/core@npm:1.0.0
│  └─ webpack@npm:5.70.0 [b5b1e] (via npm:5.70.0 [b5b1e]) 👈
│
├─ @storybook/builder-webpack4@npm:6.4.19
│  └─ webpack@npm:4.46.0 (via npm:4)
.
.

│  └─ webpack@npm:5.71.0 (via npm:^5.9.0)  👈
│
├─ @storybook/manager-webpack5@npm:6.4.19 [7f8c1]
│  └─ webpack@npm:5.71.0 [0dc39] (via npm:^5 [0dc39]) 👈
.
.

The solution for now, is to force the resolution of webpack 5, but we should issue a patch with the updated webpack version so theres no mismatch. Note that its not the updated webpack that solves the problem, its definitely a storybook thing, because even if you set the webpack version to 5.70.0 it still works fine

In your root package.json

  "resolutions": {
    "webpack": "5.71.0"
  },

Walkthrough here: https://s.tape.sh/fMzJpPyA

5reactions
dac09commented, Apr 7, 2022

Confirming that upgrading to the latest canary fixes it in the reproduction Gitpod!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues with Storybook (REDWOOD ...
Hello all,. So I'm working on a project using RedwoodJS and when I tried running yarn rw storybook. I'm getting these errors
Read more >
Replacing index.css with index.scss and Storybook issue
I got some errors running yarn rw storybook , which included the following line: Module not found: Error: Can't resolve ...
Read more >
Update to 3.0 breaks component tests - headers-polyfill/lib
Patch Release This releases fixes the Cannot find module 'headers-polyfill/lib' error seen when using mock service worker (MSW) in tests or ...
Read more >
Redwood v0.32 - Releases and Upgrade Guides
At first Error: Cannot find module 'graphql-tag' didn't make sense to me since I not using anything graphql related in my identity-signup ...
Read more >
Build error when configuring storybook
module.exports = { addons: [ '@storybook/addon-essentials', 'storybook-addon-themes'], }. But this is the only approach I found to disable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found