Skip to content

[Bug / Solved]: Storybook failed to load the following preset: .\node_modules\@storybook\angular\preset #32129

Description

@Tim-arts

Describe the bug

Getting this error while installing Storybook in a NX Monorepo:

SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: .\node_modules\@storybook\angular\preset.
Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.
If you believe this is a bug, please open an issue on Github.
SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: .\node_modules\@storybook\angular\dist\server\framework-preset-angular-cli.js.
Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.
If you believe this is a bug, please open an issue on Github.
Error: Cannot find module '@angular-devkit/build-angular/src/utils/webpack-browser-config'
Require stack:
- .\node_modules\@storybook\angular\dist\server\angular-cli-webpack.js
- .\node_modules\@storybook\angular\dist\server\framework-preset-angular-cli.js
- .\node_modules\storybook\dist\common\index.cjs
- .\node_modules\@storybook\angular\dist\builders\start-storybook\index.js
- .\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
    at Function._load (node:internal/modules/cjs/loader:1211:37)                                                                                                                                                                    
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)                                                                                                                                                                   
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)                                                                                                                                                                     
    at Module.<anonymous> (node:internal/modules/cjs/loader:1487:12)                                                                                                                                                                
    at Module.require (.\node_modules\nx\src\adapter\compat.js:73:40)                                                                                                                                                               
    at require (node:internal/modules/helpers:135:16)                                                                                                                                                                               
    at Object.<anonymous> (.\node_modules\@storybook\angular\dist\server\angular-cli-webpack.js:3:58)                                                                                                                               
More info:                                                                                                                                                                                                                          
    at loadPreset (.\node_modules\storybook\dist\common\index.cjs:23579:13)                                                                                                                                                         
More info:                                                                                                                                                                                                                          
                                                                                                                                                                                                                                    
    at loadPreset (.\node_modules\storybook\dist\common\index.cjs:23579:13)
    at async Promise.all (index 0)
    at async loadPresets (.\node_modules\storybook\dist\common\index.cjs:23589:55)
    at async getPresets (.\node_modules\storybook\dist\common\index.cjs:23622:11)
    at async buildDevStandalone (.\node_modules\storybook\dist\core-server\index.cjs:37989:11)
    at async withTelemetry (.\node_modules\storybook\dist\core-server\index.cjs:36157:12)
 NX   Broken build, fix the error above.        

Related issue: #21710

Reproduction link

https://github.com/Tim-arts/nx-monorepo

Reproduction steps

  • Create a new monorepo using the nx command: npx create-nx-workspace@latest
  • Add SB to the monorepo: nx add @nx/storybook
  • Generate SB configuration for one app: nx g @nx/angular:storybook-configuration my-angular-project
  • Run SB for that specific app: nx run my-angular-project:storybook
  • Verify the issue

I'm basically following the fresh documentation of NX and been using only official commands since for that setup

System

Storybook Environment Info:

  System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Binaries:
    Node: 22.17.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD <----- active
  Browsers:
    Edge: Chromium (138.0.3351.95)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    angularbugneeds triagenxPrioritize Nx compatibility for angularwindowsIssues related to Windows.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions