#previewBuilder.getConfig is not a function

13 messages · Page 1 of 1 (latest)

violet ingot
#

I have a react/webpack5 storybook project that had babelModeV7 storyStoreV7 already enabled and tried updating storybook through the npx cli.

And i get the following error when trying to run storybook dev. I had already gone through the migration guide as well and updated what i saw i needed to change. But this error is so cryptic and i have no idea what is actually causing this.

Does anyone have an idea what this could be ?

ERR! TypeError: previewBuilder.getConfig is not a function
ERR!     at storybookDevServer (/Users/sindris/Work/tui/node_modules/@storybook/core-server/dist/index.js:27:6175)
ERR!     at async buildDevStandalone (/Users/sindris/Work/tui/node_modules/@storybook/core-server/dist/index.js:40:2724)
ERR!     at async withTelemetry (/Users/sindris/Work/tui/node_modules/@storybook/core-server/dist/index.js:27:3469)
ERR!     at async dev (/Users/sindris/Work/tui/node_modules/@storybook/cli/dist/generate.js:439:400)
ERR!     at async Command.<anonymous> (/Users/sindris/Work/tui/node_modules/@storybook/cli/dist/generate.js:441:327)
warped pendant
#

That normally happens when you have other versions of storybook packages hanging around. Can you share the output of npx sb info?

#

The fix is normally removing your node_modules and lockfiles, and re-installing. If you don't have explicit old deps in your package.json. If you do, then you should remove or update those.

violet ingot
#

I did clear node_modules and went through the storybook directory to make sure that all version where correct but i am going to test removing the lockfile and installing again. Thanks for the tip, will report back if that does not work

violet ingot
#

here is the output from npx sb info

  System:
    OS: macOS 13.1
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Firefox: 110.0.1
    Safari: 16.2
  npmPackages:
    @storybook/addon-a11y: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/addon-docs: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/addon-essentials: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/addon-links: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/addon-mdx-gfm: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/addons: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/preset-typescript: ^3.0.0 => 3.0.0
    @storybook/react: ^7.0.0-rc.4 => 7.0.0-rc.4
    @storybook/react-webpack5: ^7.0.0-rc.4 => 7.0.0-rc.4

Based on your previous comment i assume that preset-typescript is the issue here.

#

I did try removing it from the addons array in main.js and still get the same error

thorny quail
#

Can you remove it from your package.json and reinstall?

violet ingot
#

Now i get a slightly different error

info => Starting manager..
ERR! TypeError: previewBuilder.start is not a function
ERR!     at storybookDevServer (/Users/name/project/node_modules/@storybook/core-server/dist/index.js:27:6404)
ERR!     at async buildDevStandalone (/Users/name/project/node_modules/@storybook/core-server/dist/index.js:40:2724)
ERR!     at async withTelemetry (/Users/name/project/node_modules/@storybook/core-server/dist/index.js:27:3469)
ERR!     at async dev (/Users/name/project/node_modules/@storybook/cli/dist/generate.js:439:400)
ERR!     at async Command.<anonymous> (/Users/name/project/node_modules/@storybook/cli/dist/generate.js:441:327)
warped pendant
#

When you removed your lockfile and node_modules and re-installed, did the lockfile change? if there are any node_modules from any monorepo packages hanging around, it won't work, you have to get all of them.

You can also search your lockfile to see if any old 6.5 versions of storybook packages are hanging around, though that's a bit tougher.

violet ingot
#

The lock file was updated after removing root node_modules along with all other node_modules in all packages.

I did also go through the lock file and i am not seeing any old 6.5 versions.

#

Looks like i have figured this out.

I modifed the core builder options incorrectly in main.js instead of loving the builder options into framework i just updated the builder name.

  framework: {
    name: '@storybook/react-webpack5',
    options: {
      builder: {lazyCompilation: true},
    },
  },

After removing the old core property and moving the options under framework i get past the error and storbook starts even though i still have some unresolved issues i can figure out.

Sorry about the trouble and thanks very much for taking the time to help 🙂

warped pendant
#

What did your config look like that was causing problems?

violet ingot
#

sorry about the late response but it looked like this

  core: {
    builder: {
      name: '@storybook/react-webpack5',
      options: {
        lazyCompilation: true,
      },
    },
  },
  framework: {
    name: '@storybook/react-webpack5'
  },
  stories: [
    '../stories/*.@(mdx|stories.@(ts|tsx))',
    '../packages/**/stories/*.@(mdx|stories.@(ts|tsx))',
  ],