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

Singleton client API not yet initialized, cannot call addArgTypesEnhancer. #255

Closed
olemarius opened this issue Feb 23, 2022 · 9 comments
Closed

Comments

@olemarius
Copy link

I'm getting this error with Storybook 6.4.19 for Vue3 started and storybook-builder-vite v0.1.17

ClientApi.js:85 Uncaught Error: Singleton client API not yet initialized, cannot call addArgTypesEnhancer.

image

Trying to get storybook to work with pnpm. After switching to pnpm and adding the following fix I got the error described:

    // https://github.com/eirslett/storybook-builder-vite/issues/55
    config.root = dirname(require.resolve("storybook-builder-vite"));
    config.server.fsServe = undefined;
@IanVS
Copy link
Member

IanVS commented Feb 23, 2022

This normally means there are more than one copy of @storybook/client-api in your node_modules.

See #254 for a recent fix to this project repo itself. pnpm doesn't seem to like working with this project either though, there have been a few other issues which suggested that it's necessary to shamefully hoist.

@olemarius
Copy link
Author

@IanVS thanks, I'll have another go at it with shamefully-hoist when #254 is released and let you know how it goes :-)

@IanVS
Copy link
Member

IanVS commented Feb 23, 2022

To be clear, that was a fix for our own monorepo. It was an example of what you might need to also do in your own project as well.

@zipme
Copy link

zipme commented Feb 24, 2022

Update packages.json as https://github.com/eirslett/storybook-builder-vite/pull/254/files suggests, and run pnpm install --shamefully-hoist and it works! Thanks a lot!

@IanVS
Copy link
Member

IanVS commented Mar 17, 2022

@olemarius were you able to find a solution for your issue?

@olemarius
Copy link
Author

@IanVS let me give it another go today. I did get it to work with pnpm, but I got some errors from msw that I didn't have time to dig into.

@olemarius
Copy link
Author

This did the trick!

config.resolve.dedupe = ["@storybook/client-api"]

Storybook 6.4.19
Vue 3.2.31
storybook-builder-vite 0.1.20

Thanks to #50 (comment)

@shadow7412
Copy link

Which config file was that supposed to go in?

@IanVS
Copy link
Member

IanVS commented May 13, 2022

@shadow7412 this should not be a problem in recent versions of storybook and @storybook/vite-builder. If you're having issues, it may mean that you have mismatched storybook versions, causing more than one @storybook/client-api to exist in your node_modules.

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

4 participants