-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Uncaught Error: Singleton client API not yet initialized, cannot call addArgTypesEnhancer
. with 6.5.0-alpha.39
#17504
Comments
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 have had the same thing here. Let me know if you workout what is interfering. I have my suspicions it is related to addon-storyshots |
Are either of you using the vite builder, by chance? |
I don't have the problem anymore after
and const preprocess = require("svelte-preprocess");
module.exports = {
stories: [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx|svelte)",
],
addons: ["@storybook/addon-essentials", "@storybook/addon-links"],
framework: "@storybook/svelte",
core: {
builder: "storybook-builder-vite",
},
staticDirs: ["../static"],
svelteOptions: {
preprocess: [preprocess({ postcss: true, sourceMap: true })],
},
async viteFinal(config, { configType }) {
// github.com/storybookjs/storybook/discussions/17433
// BASE_URL est définie dans `.github/workflows/storybook.yml`
const baseUrl = process.env.BASE_URL;
if (baseUrl) {
config.base = `${baseUrl}/`;
}
// `Uncaught Error: Singleton client API not yet initialized, cannot call addParameters`
// github.com/storybookjs/storybook/issues/10887#issuecomment-901109891
config.resolve.dedupe = ["@storybook/client-api"];
return config;
},
}; |
Thanks for reporting back! |
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! |
I just migrated from storybook-builder-vite 0.1.23 to @storybook/builder-vite 0.1.28 and got this error. (Tried removing |
@gwvt are you able to create a reproduction that I can take a look at? That would be super-helpful, since you've already ruled out a stale cache / version mismatch problem. |
Thanks @IanVS ! Shell output looks normal... |
Hi thanks, yes if you're able to either share a link to the repository where this is occurring (if it is open source) or create a new repository and get it into this same state, that's going to be the best way for me to dig into this. |
I'm having the same issue, and managed to duplicate it at https://github.com/thadeucity/storybook-vite-bug
|
Following these steps I was able to run the Storybook itself, but I got errors loading the components // Setup a project
yarn init
// Add Vite
yarn add -D vite
// Setting up the storybook (Selected: y -> react)
npx sb@next init --builder storybook-builder-vite
// Installing React
yarn add -D react react-dom
// Trying to run storybook
yarn storybook storybook ends up in an endless loop (missing global), so I created the file: // .storybook\preview-head.html
<script>
window.global = window;
</script> Now storybook runs, but when I try to open any of the sample components I get the error: |
It looks like you're using the older |
@IanVS
//package.json
{
"name": "vite-storybook",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.17.9",
"@storybook/addon-actions": "^6.5.0-alpha.62",
"@storybook/addon-essentials": "^6.5.0-alpha.62",
"@storybook/addon-interactions": "^6.5.0-alpha.62",
"@storybook/addon-links": "^6.5.0-alpha.62",
"@storybook/builder-vite": "^0.1.28",
"@storybook/react": "^6.5.0-alpha.62",
"@storybook/testing-library": "^0.0.9",
"babel-loader": "^8.2.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"vite": "^2.9.4"
},
"dependencies": {},
"scripts": {
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
}
} |
Thanks for the reproduction, @thadeucity. Using it, I've traced this down to 6.4 not including a fix that is in the 6.5 alphas: #17875. One workaround you can use for now, is to enable |
@gwvt @thadeucity, can you please try upgrading to storybook 6.4.22? ( |
Oh, and to create a new project, instead of manually installing vite and react separately as you show above, you can use:
Then, follow the prompts, and when done, you can
Which should get you up-and-running with a 6.5.0-alpha (or beta soon) version of storybook. |
Thank you for your help @IanVS For the sample project just updating the dependencies with But, for creating a new project I'm getting the same error I listed before (
I was able to solve the error downgrading storybook from Thank you again for the help |
Updated the bug repo with the bug described above: (the bug is fixable downgrading |
@IanVS |
@thadeucity thanks for reporting the error. I have a PR up which should fix it. #17987 |
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. |
Thanks @joungskim - that worked! And yes, I was tearing my hair out all day with this issue (it's 11pm here and just got it working) |
Describe the bug
When I updated to stroybook v.6.5.0-alpha.39 and run
npm run stroybook
, there is this error:System
Please paste the results of
npx sb@next info
here.The text was updated successfully, but these errors were encountered: