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

Fresh setup build-storybook shows error "Cannot find module '@nrwl/webpack/src/utils/config'" #14455

Closed
mauris opened this issue Jan 18, 2023 · 4 comments · Fixed by #14480
Closed
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug

Comments

@mauris
Copy link
Contributor

mauris commented Jan 18, 2023

Current Behavior

After running npx nx run <libName>:build-storybook, I got the following error output:


>  NX  Storybook builder starting ...

info => Cleaning outputDir: /Users/mauris/work/test/dist/storybook/mode
info => Loading presets
WARN   Failed to load preset: {"type":"presets","name":"/Users/mauris/work/test/node_modules/@nrwl/react/plugins/storybook/index.js"} on level 1
ERR! Error: Cannot find module '@nrwl/webpack/src/utils/config'
ERR! Require stack:
ERR! - /Users/mauris/work/test/node_modules/@nrwl/react/plugins/storybook/index.js
ERR! - /Users/mauris/work/test/node_modules/@storybook/core-common/dist/cjs/presets.js
ERR! - /Users/mauris/work/test/node_modules/@storybook/core-common/dist/cjs/index.js
ERR! - /Users/mauris/work/test/node_modules/@storybook/core-server/dist/cjs/index.js
ERR! - /Users/mauris/work/test/node_modules/@nrwl/storybook/src/executors/build-storybook/build-storybook.impl.js
ERR! - /Users/mauris/work/test/node_modules/nx/src/config/workspaces.js
ERR! - /Users/mauris/work/test/node_modules/nx/src/command-line/run.js
ERR! - /Users/mauris/work/test/node_modules/nx/bin/run-executor.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:974:19)
ERR!     at require (internal/modules/cjs/helpers.js:101:18)
ERR!     at Object.<anonymous> (/Users/mauris/work/test/node_modules/@nrwl/react/plugins/storybook/index.js:6:18)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1085:14)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:950:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
ERR!     at Module.require (internal/modules/cjs/loader.js:974:19)
ERR!  Error: Cannot find module '@nrwl/webpack/src/utils/config'
ERR! Require stack:
ERR! - /Users/mauris/work/test/node_modules/@nrwl/react/plugins/storybook/index.js
ERR! - /Users/mauris/work/test/node_modules/@storybook/core-common/dist/cjs/presets.js
ERR! - /Users/mauris/work/test/node_modules/@storybook/core-common/dist/cjs/index.js
ERR! - /Users/mauris/work/test/node_modules/@storybook/core-server/dist/cjs/index.js
ERR! - /Users/mauris/work/test/node_modules/@nrwl/storybook/src/executors/build-storybook/build-storybook.impl.js
ERR! - /Users/mauris/work/test/node_modules/nx/src/config/workspaces.js
ERR! - /Users/mauris/work/test/node_modules/nx/src/command-line/run.js
ERR! - /Users/mauris/work/test/node_modules/nx/bin/run-executor.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:974:19)
ERR!     at require (internal/modules/cjs/helpers.js:101:18)
ERR!     at Object.<anonymous> (/Users/mauris/work/test/node_modules/@nrwl/react/plugins/storybook/index.js:6:18)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1085:14)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:950:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
ERR!     at Module.require (internal/modules/cjs/loader.js:974:19) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   requireStack: [
ERR!     '/Users/mauris/work/test/node_modules/@nrwl/react/plugins/storybook/index.js',
ERR!     '/Users/mauris/work/test/node_modules/@storybook/core-common/dist/cjs/presets.js',
ERR!     '/Users/mauris/work/test/node_modules/@storybook/core-common/dist/cjs/index.js',
ERR!     '/Users/mauris/work/test/node_modules/@storybook/core-server/dist/cjs/index.js',
ERR!     '/Users/mauris/work/test/node_modules/@nrwl/storybook/src/executors/build-storybook/build-storybook.impl.js',
ERR!     '/Users/mauris/work/test/node_modules/nx/src/config/workspaces.js',
ERR!     '/Users/mauris/work/test/node_modules/nx/src/command-line/run.js',
ERR!     '/Users/mauris/work/test/node_modules/nx/bin/run-executor.js'
ERR!   ]
ERR! }

Expected Behavior

No error should be shown

Github Repo

No response

Steps to Reproduce

  1. Run npx nx run <libName>:build-storybook on a newly setup workspace.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node : 14.21.2
   OS   : darwin arm64
   npm  : 6.14.17
   
   nx : 15.5.2
   @nrwl/angular : Not Found
   @nrwl/cypress : 15.5.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.5.2
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.5.2
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.5.2
   @nrwl/js : 15.5.2
   @nrwl/linter : 15.5.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 15.5.2
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.5.2
   @nrwl/schematics : Not Found
   @nrwl/storybook : 15.5.2
   @nrwl/web : 15.5.2
   @nrwl/webpack : Not Found
   @nrwl/workspace : 15.5.2
   @nrwl/vite : Not Found
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

Failure Logs

No response

Additional Information

No response

@alexmbp
Copy link

alexmbp commented Jan 18, 2023

I have the same issue in the repo. But my setup was working before I updated Nx.
Issue appeared after I migrated from 15.4.1 to 15.5.2.

I was able to get rid of the warning, by manually installing @nrwl/webpack.

@mauris
Copy link
Contributor Author

mauris commented Jan 18, 2023

I upgraded from 15.4.4. It started showing when I was at 15.4.8. I had the same resolution to rid the errors, by installing @nrwl/webpack. 🙇🏻

@mandarini mandarini self-assigned this Jan 18, 2023
@mandarini mandarini added the scope: storybook Issues related to Storybook support in Nx label Jan 18, 2023
@jaysoo jaysoo self-assigned this Jan 18, 2023
@jaysoo
Copy link
Member

jaysoo commented Jan 18, 2023

Looks like webpack is not installed. We need to add a migration to install it if it's missing.

Previously it must have resolved due to @nrwl/react and @nrwl/web having a dependency on it, and it was hoisted to root node_modules. I'll patch it.

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants