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

[Bug]: storybook@next init fails on svelte(-kit) project #28475

Closed
manuel3108 opened this issue Jul 7, 2024 · 8 comments
Closed

[Bug]: storybook@next init fails on svelte(-kit) project #28475

manuel3108 opened this issue Jul 7, 2024 · 8 comments

Comments

@manuel3108
Copy link

Describe the bug

Looks like this is only happening on the beta build @8.2.0-beta.0.
The cli fails with an unexpected error:

Error: TypeError: wnt.default is not a function

Relates #27096
Relates #28474
Relates svelte-add/svelte-add#475

Reproduction link

https://github.com/manuel3108/storybook-missing-packages-repro (Reused from related issue)

Reproduction steps

Exception details:

An error occurred while installing dependencies:
wnt.default is not a function

 Error: TypeError: wnt.default is not a function
at QJ.addDependencies (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\@storybook\core\dist\common\index.cjs:153207:72)
at async baseGenerator (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\storybook\dist\generate.cjs:96:1229)
at async generator15 (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\storybook\dist\generate.cjs:133:3110)
at async installStorybook (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\storybook\dist\generate.cjs:145:4887)
at async doInitiate (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\storybook\dist\generate.cjs:155:894) 
at async withTelemetry (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\@storybook\core\dist\core-server\index.cjs:188662:12)
at async initiate (C:\Users\manue\AppData\Local\npm-cache\_npx\eb8bf615e50a412a\node_modules\storybook\dist\generate.cjs:180:214)   

⠏ Installing Storybook dependencies
attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

Even easier is to have a look at this CI output: https://github.com/manuel3108/storybook-missing-packages-repro/actions/runs/9825360106/job/27125418556

System

(from CI)

Storybook Environment Info:

  System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.15.0 - /opt/hostedtoolcache/node/20.15.0/x64/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.7.0 - /opt/hostedtoolcache/node/20.15.0/x64/bin/npm <----- active
    pnpm: 9.4.0 - /opt/hostedtoolcache/node/20.15.0/x64/bin/pnpm
  Browsers:
    Chrome: 126.0.6478.126

Additional context

Very similar issue to #28474. The difference is that this issue even happens without adding any additional commands, and the generated exception is a totally different one from the related issue.

Copy link
Contributor

greptile-apps bot commented Jul 7, 2024

The error wnt.default is not a function seems to be related to the baseGenerator function in baseGenerator.ts and the installStorybook function in initiate.ts. The issue might be due to an incorrect import or usage of a function within these files. Specifically, check the imports and ensure that all functions are correctly imported and used. For example, verify that the addDependencies function is correctly imported and used in baseGenerator.ts.

References

/code/lib/cli/src/initiate.ts
/code/lib/cli/src/generators/baseGenerator.ts
/code/frameworks/svelte-webpack5
/code/frameworks/sveltekit

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Jul 10, 2024

This should be fixed in 8.2.0. Can you please try it out?

@manuel3108
Copy link
Author

This is resolved!

@DemaPy
Copy link

DemaPy commented Jul 11, 2024

I had the same problem with storybook if using react 17 version.

Just update to the latest one.

@dep
Copy link

dep commented Jul 31, 2024

Same problem today in my React 18 + SB 8.2 codebase.

npx storybook@latest migrate mdx-to-csf --glob "src/**/*.stories.mdx"
✅ Adding "@storybook/blocks" package

An error occurred while installing dependencies:
wnt.default is not a function
Error: TypeError: wnt.default is not a function
    at QJ.addDependencies (/Users/dpeck/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/common/index.cjs:153206:72)
    at async addStorybookBlocksPackage (/Users/dpeck/.npm/_npx/bc7e1e37fcb46ffc/node_modules/storybook/dist/generate.cjs:665:3906)
    at async migrate (/Users/dpeck/.npm/_npx/bc7e1e37fcb46ffc/node_modules/storybook/dist/generate.cjs:665:3374)

@thulasi127
Copy link

Also getting the same exact output/problem in my Angular CLI 17.2.3 + Node: 18.15.0 codebase

@ben-hamel
Copy link

getting this in Vue3+Vite project as well

@indapublic
Copy link

React 18.2 + Storybook 8.2.9

image

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

No branches or pull requests

8 participants