Storybook: Build Error - No configuration files have been found in your configDir

Created on 9 Apr 2021  路  5Comments  路  Source: nuxt-community/storybook

Version

@nuxtjs/storybook:
nuxt:

Steps to reproduce

npm install --save-dev @nuxtjs/storybook

Then:
npx nuxt storybook build

What is Expected?

That the storybook gets built into a static directory.

What is actually happening?

At static build, it crashes with the following error. Notice how it is complaining about /.storybook but I'd expect that should be .nuxt-storybook. Maybe that is the issue?

The regular npx nuxt storybook runs fine, it's just the static build that is failing.

ERR! Error: No configuration files have been found in your configDir (/Users/drew/Sites/library-website-nuxt/.storybook).
ERR! Storybook needs either a "main" or "config" file.
ERR!     at validateConfigurationFiles (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-common/dist/cjs/utils/validate-c
onfiguration-files.js:50:11)
ERR!     at loadCustomPresets (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-common/dist/cjs/utils/load-custom-presets
.js:19:62)
ERR!     at loadAllPresets (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-common/dist/cjs/presets.js:310:105)
ERR!     at buildStaticStandalone (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-server/dist/cjs/build-static.js:95:48
)
ERR!     at async Object.buildStatic (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-server/dist/cjs/build-static.js:14
2:5)
ERR!  Error: No configuration files have been found in your configDir (/Users/drew/Sites/library-website-nuxt/.storybook).
ERR! Storybook needs either a "main" or "config" file.
ERR!     at validateConfigurationFiles (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-common/dist/cjs/utils/validate-c
onfiguration-files.js:50:11)
ERR!     at loadCustomPresets (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-common/dist/cjs/utils/load-custom-presets
.js:19:62)
ERR!     at loadAllPresets (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-common/dist/cjs/presets.js:310:105)
ERR!     at buildStaticStandalone (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-server/dist/cjs/build-static.js:95:48
)
ERR!     at async Object.buildStatic (/Users/drew/Sites/library-website-nuxt/node_modules/@storybook/core-server/dist/cjs/build-static.js:14
2:5)

My storybook config in nuxt.config.js is this:

storybook: {
        stories: ["~/stories/**/*.stories.js"],
        parameters: {
            layout: "fullscreen",
            backgrounds: {
                default: "default",
                values: [
                    {
                        name: "White",
                        value: "#ffffff",
                    },
                    {
                        name: "Grey",
                        value: "#F2F2F2",
                    },
                    {
                        name: "Dark blue",
                        value: "#032D5B",
                    },
                    {
                        name: "Blue",
                        value: "#0B6AB7",
                    },
                    {
                        name: "Light blue",
                        value: "#EAF2FB",
                    },
                ],
            },
        },
        webpackFinal(config, { configDir }) {
            // Allow webpack to auto-load .gql and .svg files
            config.resolve.extensions.push(".gql", ".svg")

            return config
        },
    },
bug

Most helpful comment

Just released v4.0.2 with [email protected]
Thank to @lihbr

All 5 comments

I found a temporary workaround.
Setting the SBCONFIG_CONFIG_DIR to ./.nuxt-storybook/storybook works for me:
env SBCONFIG_CONFIG_DIR=./.nuxt-storybook/storybook npx nuxt storybook build

Thank for the issue, this feature is breaks in Storybook v6.2. Meanwhile you can use @nielwijers solution

Fixed: https://github.com/storybookjs/storybook/pull/14566 馃檶 hopefully will get published in a few days~

Edit: will be part of 6.3 actually :c https://github.com/storybookjs/storybook/issues/14561#issuecomment-818561039

Edit 2: It's released on 6.2.8, everyone can upgrade their dependency and we can close this issue 馃帀

Just released v4.0.2 with [email protected]
Thank to @lihbr

Was this page helpful?
0 / 5 - 0 ratings