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.

ERR! Error: Cannot find module 'html-webpack-plugin' after upgrading to Cypress v10

See original GitHub issue

Describe the bug Since upgrading cypress from v9 to v10 I get the following error in storybook.

I have also added html-webpack-plugin manually via yarn add -D html-webpack-plugin, but it doesn’t solve the issue.

System Please paste the results of npx sb@next info here.

Environment Info:

  System:
    OS: macOS 12.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.10.0/bin/yarn
    npm: 7.24.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
  npmPackages:
    @storybook/addon-a11y: ^6.5.9 => 6.5.9
    @storybook/addon-actions: ^6.5.9 => 6.5.9
    @storybook/addon-essentials: ^6.5.9 => 6.5.9
    @storybook/addon-links: ^6.5.9 => 6.5.9
    @storybook/builder-webpack5: ^6.5.9 => 6.5.9
    @storybook/manager-webpack5: ^6.5.9 => 6.5.9
    @storybook/react: ^6.5.9 => 6.5.9
    @storybook/testing-react: ^1.3.0 => 1.3.0

Additional context

Run yarn storybook:build
yarn run v1.22.19
$ build-storybook -o ./out/storybook
info @storybook/react v6.5.9
info 
info => Cleaning outputDir: /home/runner/work/vision-prototype/vision-prototype/out/storybook
info => Loading presets
WARN   Failed to load preset: "/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js"
ERR! Error: Cannot find module 'html-webpack-plugin'
ERR! Require stack:
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-common/dist/cjs/presets.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-common/dist/cjs/index.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-server/dist/cjs/index.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core/dist/cjs/server.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core/server.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/react/dist/cjs/server/build.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/react/bin/build.js
ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
ERR!     at Function.Module._load (node:internal/modules/cjs/loader:77[8](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:9):27)
ERR!     at Module.require (node:internal/modules/cjs/loader:1005:1[9](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:10))
ERR!     at require (node:internal/modules/cjs/helpers:[10](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:11)2:18)
ERR!     at Object.<anonymous> (/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js:51:49)
ERR!     at Module._compile (node:internal/modules/cjs/loader:[11](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:12)05:14)
ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:[12](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:13))
ERR!     at Module.require (node:internal/modules/cjs/loader:1005:19)
ERR!  Error: Cannot find module 'html-webpack-plugin'
ERR! Require stack:
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-common/dist/cjs/presets.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-common/dist/cjs/index.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-server/dist/cjs/index.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core/dist/cjs/server.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core/server.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/react/dist/cjs/server/build.js
ERR! - /home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/react/bin/build.js
ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
ERR!     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
ERR!     at Module.require (node:internal/modules/cjs/loader:1005:19)
ERR!     at require (node:internal/modules/cjs/helpers:102:18)
ERR!     at Object.<anonymous> (/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js:51:49)
ERR!     at Module._compile (node:internal/modules/cjs/loader:1105:[14](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:15))
ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1[15](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:16)9:10)
ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
ERR!     at Module.require (node:internal/modules/cjs/loader:1005:[19](https://github.com/Design-Commerce-Technology/vision-prototype/runs/7046605928?check_suite_focus=true#step:7:20)) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   requireStack: [
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-common/dist/cjs/presets.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-common/dist/cjs/index.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core-server/dist/cjs/index.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core/dist/cjs/server.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/core/server.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/react/dist/cjs/server/build.js',
ERR!     '/home/runner/work/vision-prototype/vision-prototype/node_modules/@storybook/react/bin/build.js'
ERR!   ]
ERR! }

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
essential-randomnesscommented, Jun 26, 2022

Having a similar issue that I’m still trying to debug, also after upgrading Cypress. I was also trying to downgrade Storybook from using webpack 5 to 4, and assumed that was the root cause of my issue, but this bug is making me rethink the assumption.

One help I can offer, is that I noticed that @cypress/webpack-dev-server pulls both html-webpack-plugin-5 and html-webpack-plugin-4 as a dependency, and I’m wondering whether that’s part of the issue:

"@cypress/webpack-dev-server@^2.0.0":
  version "2.0.0"
  resolved "https://registry.yarnpkg.com/@cypress/webpack-dev-server/-/webpack-dev-server-2.0.0.tgz#6379b28f2047bd8e6f7bf8027d4f693a545992d4"
  integrity sha512-N3NOwe+tX+jEgl0+ljxGfbIbeXi/h46JvA2nTGUCGFUfyOGElfBtBPjS5KeCix2k7wM2f4L4StkzlpDkIRBlcg==
  dependencies:
    find-up "6.3.0"
    fs-extra "9.1.0"
    html-webpack-plugin-4 "npm:html-webpack-plugin@^4"
    html-webpack-plugin-5 "npm:html-webpack-plugin@^5"
    local-pkg "0.4.1"
    speed-measure-webpack-plugin "1.4.2"
    tslib "^2.3.1"
    webpack-dev-server "^4.7.4"
    webpack-merge "^5.4.0"

Will report back if I figure out more.

0reactions
lmiller1990commented, Jul 1, 2022

This seems like the problem. I wonder yarn won’t install it. Another question: did you try npm? Just to see if this is potentially a yarn specific error (we should fix it, if we can, but minimizing the surface area for the bug is useful).

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERR! Error: Cannot find module 'html-webpack-plugin' in ...
Current behavior After upgrading to Cypress v.10 and @cypress/webpack-dev-server@^2.0.0, now Storybook throws the following error: Run yarn ...
Read more >
Error: Cannot find module 'html-webpack-plugin'
UPDATE : I noticed that I cannot see the version for "html-webpack-plugin". It displays as it is not installed. However, I have installed...
Read more >
Cannot find module 'html-webpack-plugin' error | bobbyhadz
To solve the error "Cannot find module 'html-webpack-plugin'", make sure to install the html-webpack-plugin package by opening your terminal in your project's ...
Read more >
webpack/webpack - Gitter
So I'm running into an issue where Error: Cannot find module '. ... After installing the raw-loader package v3.1.0 the app crashes with...
Read more >
@cypress/webpack-dev-server | Yarn - Package Manager
Note: This package is bundled with the Cypress binary and should not need to be installed separately. See the Component Framework Configuration Docs...
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