storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.47k stars 9.28k forks source link

Uncaught (in promise) Error: No `docs.container` set #17527

Closed belforto closed 1 year ago

belforto commented 2 years ago

Why I get this error? //storybook/main.tsx

stories: ["../src/components/*/.stories.@(tsx|mdx)", "../src/styles/*.stories.@(tsx|mdx)",],

addons: [ "@storybook/addon-essentials", "@storybook/addon-actions/register", "@storybook/addon-controls", "@storybook/addon-viewport", { name: '@storybook/addon-docs', options: { configureJSX: true, babelOptions: {}, sourceLoaderOptions: null, transcludeMarkdown: true, }, }, ],

and this is my mdx file //BlogCard.stories.mdx

import { Meta, Story } from '@storybook/addon-docs/blocks'; import * as stories from './BlogCard.stories.tsx'; import BlogCard from "./index";

...some random markdown here

blowsie commented 2 years ago

I get a similar issue, reproduction is available here https://github.com/blowsie/vue3-vitesse-storybook-pnpm/tree/master/packages/ui

image

charleshimmer commented 2 years ago

I'm getting this error after upgrading from storybook 6.4 to 6.5 using react. Every figure out what was going on?

shilman commented 2 years ago

@charleshimmer Do you a have a reproduction repo you can share? If not, can you create one? See how to create a repro. Thank you! 🙏

codesman commented 2 years ago

I got this error today when I had accidentally installed @storybook/addon-docs": "6.5.5", when the rest of the storybook deps were at 6.4.22. The Docs tab was missing as well and the markdown in my .mdx was not rendered. This is in an NX 13.4.6 repo.

charleshimmer commented 2 years ago

I found my issue was the path for the addon-docs needed to be changed from '@storybook/addon-docs/preset' to '@storybook/addon-docs' in .storybook/main.js.

charleshimmer commented 2 years ago

Hot reloading does seem to not be working though now :(.

konsalex commented 2 years ago

Hey folks, any update regarding this issue?

Happened to us too upgrading from 6.3.12 to 6.5.9. Additionally MDX stories are breaking too

shilman commented 2 years ago

@konsalex Do you a have a reproduction repo you can share? If not, can you create one? See how to create a repro. Thank you! 🙏

dagjomar commented 2 years ago

Also had the same problem with version 6.5.9 Downgraded to the following set of versions and everything works fine again:

"@storybook/addon-actions": "~6.4.22",
"@storybook/addon-essentials": "~6.4.22",
"@storybook/addon-interactions": "~6.4.22",
"@storybook/addon-links": "~6.4.22",
"@storybook/builder-webpack5": "~6.4.22",
"@storybook/manager-webpack5": "~6.4.22",
"@storybook/react": "~6.4.22",
"@storybook/testing-library": "^0.0.11",

Would love for someone to figure out what the problem is

kherock commented 2 years ago

@shilman I don't have time to create a full repro, but I believe I was able track this regression to #17755.

I have two storybooks with this problem, and it seems like the only ingredient for this to occur is to have a custom .storybook/preview.js. The error is thrown due to some refactoring of getContainer() and getPage() parameters in the default addon-docs preset. In 6.4, they were configured in config.ts, loaded in the common-preset module:

https://github.com/storybookjs/storybook/blob/8dd4fa6ef42f803ec276be18fb78644a827d5b74/addons/docs/preset.js#L10-L16

6.5 seems to have completely rewritten the preset entrypoint and I'm still investigating what needs to be done in order to fix this. In the meantime, I can get docs working again by including this in my .storybook/preview.js file:


export const parameters = {
  docs: {
    ...require('@storybook/addon-docs/preview').parameters.docs,
    // other config
  }
}
bartaz commented 2 years ago

I found my issue was the path for the addon-docs needed to be changed from '@storybook/addon-docs/preset' to '@storybook/addon-docs' in .storybook/main.js.

Thanks @charleshimmer this has solved this issue in our case as well.

shilman commented 1 year ago

We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if: