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

Storybook Doesn't Work on Windows #157

Open
andria-dev opened this issue Sep 22, 2024 · 0 comments
Open

Storybook Doesn't Work on Windows #157

andria-dev opened this issue Sep 22, 2024 · 0 comments

Comments

@andria-dev
Copy link

After setting up a brand new open-wc web component project with demoing enabled, I am unable to get yarn run storybook to work (but only on Windows). I get the following error:

SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: @web\storybook-framework-web-components\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.

.\node_modules\@web\storybook-framework-web-components\preset.mjs:2
import cjsEntrypoint from './dist/preset.js';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:76:18)
    at wrapSafe (node:internal/modules/cjs/loader:1283:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Object.newLoader [as .mjs] (.\node_modules\esbuild-register\dist\node.js:2262:9)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at interopRequireDefault (.\node_modules\@storybook\core-common\dist\index.js:6:21)
    at loadPreset (.\node_modules\@storybook\core-common\dist\index.js:15:82)

Wondering if this was a Windows issue, I made a nushell script to reproduce the project setup and a Nix flake to ensure a reproducible environment. Running that flake with nix develop sets up the environment and runs the setup script. This all works just fine for running the storybook command on Linux (NixOS-WSL), but running the same setup script on Windows and then running the storybook command produces the aforementioned error.

For now I'm likely going to continue working on my project on NixOS since the storybook command works there, but any help figuring out what's causing the above error and how we can fix it would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant