storybook: Uncaught Error: Singleton client API not yet initialized, cannot call `addArgTypesEnhancer`. with 6.5.0-alpha.39
Describe the bug
When I updated to stroybook v.6.5.0-alpha.39 and run npm run stroybook, there is this error:
Uncaught Error: Singleton client API not yet initialized, cannot call `addArgTypesEnhancer`.
System
Please paste the results of npx sb@next info here.
System:
OS: Linux 5.13 Ubuntu 21.10 21.10 (Impish Indri)
CPU: (8) x64 Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Binaries:
Node: 17.5.0 - /usr/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 8.4.1 - /usr/bin/npm
Browsers:
Firefox: 96.0
npmPackages:
@storybook/addon-actions: ^6.5.0-alpha.39 => 6.5.0-alpha.39
@storybook/addon-docs: ^6.5.0-alpha.39 => 6.5.0-alpha.39
@storybook/addon-essentials: ^6.5.0-alpha.39 => 6.5.0-alpha.39
@storybook/addon-links: ^6.5.0-alpha.39 => 6.5.0-alpha.39
@storybook/addon-svelte-csf: ^1.1.0 => 1.1.0
@storybook/svelte: ^6.5.0-alpha.39 => 6.5.0-alpha.39
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (11 by maintainers)
I don’t have the problem anymore after
and
./storybook/main.cjsfile. : look atconfig.resolve.dedupeHitting the same thing after upgrading from 6.3.12 to 6.4.19. My understanding is that this is caused by multiple@storybook/client-apiinstances in the node_modules directory however going back to a working state I found that this was the case in both the working as well as the broken state. I havenode_modules/@storybook/client-apias well asnode_modules/@storybook/preact/node_modules/@storybook/client-apiand no idea why the packages of the preact package aren’t hoisted.Before I go down that rabbit hole any further, could someone confirm that this is indeed the culprit (in that case I would be curious why it worked with 6.3.12 before)?Scratch all that; it wasn’t the upgrade; some other dependency seemed to have caused mayhem; I will report here when I found out which one it was.
I’m not sure if this will help anyone, but I spent a day with this exact same issue. I believe if you are on a Windows machine the case sensitivity of the path in power shell specifically matters. This caused the issue where the casing was mismatched and gave me this error. When I went back and tabbed through each of the folders within the path, it fixed the issue.
@thadeucity thanks for reporting the error. I have a PR up which should fix it. https://github.com/storybookjs/storybook/pull/17987
@IanVS
npx sb@next upgradeworks! Thank you very much for your help.Updated the bug repo with the bug described above: (the bug is fixable downgrading
@storybook/*to6.4.22) https://github.com/thadeucity/storybook-vite-bug@IanVS I tried as suggested but I’m receiving the same error (also tried without the
--builder)@IanVS
I’m having the same issue, and managed to duplicate it at https://github.com/thadeucity/storybook-vite-bug
System: OS: Windows 10.0.22000.527 CPU: (8) x64 Intel® Core™ i7-11800H CPU @ 4.60GHz
Binaries: Node: v16.14.2 Yarn: 1.22.18 npm: 8.5.5
Browsers: Firefox: 101.0a1
Figured I would report back as well; I am not using vite but after starting from scratch again, I cannot reproduce this anymore either. This attempt I haven’t tried to move to webpack 5 though, which may have been an issue before considering this appears to have been solved for vite with a dedupe option. If I move on from webpack 4, I will probably try to jump straight to vite though so hopefully I won’t see this again!
Thanks for the vite-fix!
Are either of you using the vite builder, by chance?