storybook: [Storybook 6.4] Error loading story index

Describe the bug During migration 6.3.12 -> 6.4.4 started getting this error on page load:

index.js:56 Error loading story index:
index.js:56 TypeError: Cannot read properties of undefined (reading 'type')
    at normalizeInputType (normalizeInputTypes.js:24)
    at mapValues.js:38
    at _createBaseFor.js:17
    at baseForOwn (_baseForOwn.js:13)
    at mapValues (mapValues.js:37)
    at normalizeInputTypes (normalizeInputTypes.js:44)
    at processCSFFile (processCSFFile.js:54)
    at StoryStore.memoizerific [as processCSFFileWithCache] (memoizerific.js:170)
    at StoryStoreFacade.js:104
    at Array.map (<anonymous>)

System

Environment Info:

  System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Binaries:
    Node: 16.13.0 - /usr/local/Cellar/node@16/16.13.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.0 - /usr/local/Cellar/node@16/16.13.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Firefox: 94.0.2
    Safari: 15.1
  npmPackages:
    @storybook/addon-actions: ^6.4.4 => 6.4.4
    @storybook/addon-controls: 6.4.4 => 6.4.4
    @storybook/addon-docs: 6.4.4 => 6.4.4
    @storybook/addon-essentials: ^6.4.4 => 6.4.4
    @storybook/addon-links: ^6.4.4 => 6.4.4
    @storybook/addons: 6.4.4 => 6.4.4
    @storybook/codemod: 6.4.4 => 6.4.4
    @storybook/react: 6.4.4 => 6.4.4
    @storybook/storybook-deployer: ^2.8.10 => 2.8.10

.storybook/main.js

module.exports = {
  stories: ['../src/components/**/*.stories.@(ts|tsx|js|jsx)'],
  addons: [
    {
      name: '@storybook/addon-docs',
      options: {
        configureJSX: true,
      },
    },
    '@storybook/addon-controls',
  ],
  staticDirs: [
    '../static'
  ],
  typescript: {
    check: false,
    checkOptions: {},
    reactDocgen: 'react-docgen-typescript',
    reactDocgenTypescriptOptions: {
      shouldExtractLiteralValuesFromEnum: true,
      propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
    },
  },
  webpackFinal: config => {
    return {
      ...config,
      plugins: config.plugins.filter(plugin => {
        // Remove the eslint-webpack-plugin: We already check our code, storybook doesn't need to bother
        if (plugin.constructor.name === 'ESLintWebpackPlugin') {
          return false
        }
        return true
      }),
    }
  },
  framework: "@storybook/react",
}

looks like this error was also seen in the alpha version: https://github.com/storybookjs/storybook/issues/16069

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 9
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I get this error only with storyStoreV7 enabled (6.5.10)

  core: {
    builder: "webpack5"
  },
  features: {
    babelModeV7: true,
    emotionAlias: false,
    storyStoreV7: true
  },
  stories: [path.join(__dirname, "..", "src/**/*.stories.@(js|jsx|ts|tsx|mdx)")],
  addons: ["@storybook/addon-essentials"],

Can confirm I see the same. 6.4.0 even shows the same behavior. Reverting to 6.3.12 makes things work again.

Ran into this issue upgrading from storybook 6.4.22 to 6.5.10. Storybook runs fine, but I get this error when running Storyshot tests:

Error loading story index & TypeError: fetch is not a function

I am encountering a similar issue when upgrading storybook from 6.3.12 to 6.4.*. The storybook source tab hangs on …loading source…

Updated from 6.3.12 to 6.5.9 and still had this issue.

Updated from 6.3.8 to 6.4.19 and encountered this issue. An argType set to null was the culprit just as it was for @pustovalov. I feel confident I can repro this and will probably set up something.

We got this same error when we had ^6.1.9 in our package.json for Storybook (/react and /addon-a11y, addon-actions, addon-controls, /addon-docs, addon-essentials, addon-links, addon-storysource and /addon-viewport).

Changing them to 6.4.9, 6.4.4, and 6.4.0 (without the ^) did not work for us. We had to change them to 6.3.12 to resolve the error.

I got this same error when I had version ^6.3.7 in my package.json for Storybook (/react and addon-actions, addon-essentials, addon-links and node-logger). That actually installed Storybook 6.4.9 (as ^ in semver allows).

But then when I changed the version to one without the caret, i.e. to 6.4.9 (to all those packages), it started working again. So I wonder if the problem is with some incompatibilities between the addons and the main package that arise if they have different minor versions installed. I also tested 6.4.0 and 6.4.4 and they worked as well.