Storybook: Storybook needs either a "main" or "config" file

Created on 14 Aug 2020  ·  3Comments  ·  Source: nuxt-community/storybook

Version

@nuxtjs/storybook: ^v2.1.0
nuxt: ^2.10.0

Steps to reproduce

Followed basic setup steps

What is Expected?

storybook to run

What is actually happening?

 elaniobro  ~/Sites/ui-github   master ● ? ⍟9  yarn storybook                                                        ✔  7352  08:26:09
yarn run v1.22.4
$ nuxt storybook

 WARN  devModules has been renamed to buildModules and will be removed in Nuxt 3.                                                                                   08:26:27

ℹ Preparing project for development                                                                                                                                 08:26:28
ℹ Initial build may take a while                                                                                                                                    08:26:28
✔ Builder initialized                                                                                                                                               08:26:28
✔ Nuxt files generated                                                                                                                                              08:26:28
ℹ Waiting for file changes                                                                                                                                          08:26:28
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
info @nuxtjs/storybook v2.1.0
info 
info => Loading static files from: /Users/elaniobro/Sites/ui-github/static .
WARN Unable to close preview build!
ERR! Error: No configuration files have been found in your configDir (/Users/elaniobro/Sites/ui-github/.nuxt-storybook/storybook).
ERR! Storybook needs either a "main" or "config" file.
ERR!     at validateConfigurationFiles (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/utils/validate-configuration-files.js:50:11)
ERR!     at loadCustomPresets (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/common/custom-presets.js:19:43)
ERR!     at _default (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/manager/manager-config.js:160:143)
ERR!     at _default (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/dev-server.js:58:51)
ERR!     at buildDevStandalone (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/build-dev.js:438:57)
ERR!     at async Object.buildDev (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/build-dev.js:520:3)
ERR!  Error: No configuration files have been found in your configDir (/Users/elaniobro/Sites/ui-github/.nuxt-storybook/storybook).
ERR! Storybook needs either a "main" or "config" file.
ERR!     at validateConfigurationFiles (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/utils/validate-configuration-files.js:50:11)
ERR!     at loadCustomPresets (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/common/custom-presets.js:19:43)
ERR!     at _default (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/manager/manager-config.js:160:143)
ERR!     at _default (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/dev-server.js:58:51)
ERR!     at buildDevStandalone (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/build-dev.js:438:57)
ERR!     at async Object.buildDev (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/build-dev.js:520:3) {
ERR!   stack: 'Error: No configuration files have been found in your configDir (/Users/elaniobro/Sites/ui-github/.nuxt-storybook/storybook).\n' +
ERR!     'Storybook needs either a "main" or "config" file.\n' +
ERR!     '    at validateConfigurationFiles (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/utils/validate-configuration-files.js:50:11)\n' +
ERR!     '    at loadCustomPresets (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/common/custom-presets.js:19:43)\n' +
ERR!     '    at _default (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/manager/manager-config.js:160:143)\n' +
ERR!     '    at _default (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/dev-server.js:58:51)\n' +
ERR!     '    at buildDevStandalone (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/build-dev.js:438:57)\n' +
ERR!     '    at async Object.buildDev (/Users/elaniobro/Sites/ui-github/node_modules/@storybook/core/dist/server/build-dev.js:520:3)'
ERR! }

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
bug

Most helpful comment

Getting this same error today:

info @nuxtjs/storybook v4.0.1
info
info => Cleaning outputDir: /Users/drew/Sites/library-website-nuxt/storybook-static
info => Copying static files: /Users/drew/Sites/library-website-nuxt/static => ./
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)

Running latest Nuxt (2.15.4) and Storybook (4.0.1). Node version 14.15.4.

/*
     ** Storybook
     ** SEE https://storybook.nuxtjs.org/options
     */
    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
        },
    },

All 3 comments

Please update your nuxt version, the storybook does not work well with old versions of nuxt.

@farnabaz I ran yarn upgrade-interactive --latest and upgraded my nuxt to v2.14.1 and re-ran yarn nuxt storybook This resolved my issue.

Perhaps a PR for the setup page is needed to indicate that storybook only plays nice with v2.14.1? I did see the core-js@3 note and tried that before to no avail.

Thank you for your reply.

Getting this same error today:

info @nuxtjs/storybook v4.0.1
info
info => Cleaning outputDir: /Users/drew/Sites/library-website-nuxt/storybook-static
info => Copying static files: /Users/drew/Sites/library-website-nuxt/static => ./
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)

Running latest Nuxt (2.15.4) and Storybook (4.0.1). Node version 14.15.4.

/*
     ** Storybook
     ** SEE https://storybook.nuxtjs.org/options
     */
    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
        },
    },
Was this page helpful?
0 / 5 - 0 ratings