Skip to content

[storybook-angular] Unable to run or build storybook on windows #1723

@rgylesbedford

Description

@rgylesbedford

Please provide the environment you discovered this bug in.

  • Windows (arm64 and amd64) with Node v22.
  • Not an issue on macOS (arm64) node v22.14.0 or linux (x64) node v22.15.0

Which area/package is the issue in?

Don't know / other

Description

Unable to run or build storybook on a windows machine when using @analogjs\storybook-angular as the framework.

Note: Storybook worked with angular using the previous analogjs vite instructions.

Please provide the exception or error you saw

> storybook build --output-dir dist/storybook

@storybook/core v8.6.12

info => Cleaning outputDir: dist\storybook
The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
info => Loading presets
SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: @analogjs\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.

Error: Cannot find module '@analogjs\storybook-angular\preset'
Require stack:
- .\node_modules\@storybook\core\dist\common\index.cjs
- .\node_modules\storybook\dist\proxy.cjs
- .\node_modules\storybook\bin\index.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1249:15)
    at Module._resolveFilename (.\node_modules\esbuild-register\dist\node.js:4794:36)
    at Module._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:141:16)
    at interopRequireDefault (.\node_modules\@storybook\core\dist\common\index.cjs:11704:11)
    at getContent (.\node_modules\@storybook\core\dist\common\index.cjs:16474:10)
    at loadPreset (.\node_modules\@storybook\core\dist\common\index.cjs:16480:51)

More info:

    at loadPreset (.\node_modules\@storybook\core\dist\common\index.cjs:16515:13)

Other information

I think this is similar to storybookjs/addon-webpack5-compiler-swc#11

When I look at node_modules\@analogjs\storybook-angular\src\preset.js, it is a commonjs file rather than esm and uses require(...) to load esm files from storybook's packages.

I would recommend updating the @analogjs\storybook-angular package to be esm based.

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions