question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

previewBuilder.bail is not a function

See original GitHub issue

Hey! I recently upgraded from v7.0.0-alpha.33 -> .34 in order to get around a bug that was patched with this PR. npm run storybook worked great when this patch was added locally.

After upgrading however, a new error appears when I try to run Storybook saying that previewBuilder.bail is not a function at @storybook/core-server/dist/cjs/dev-server.js:216:91.

I got the same error when I tried:

  • Removing node_modules and running npm install again
  • Reverting the repo to a state before Storybook and doing npx storybook init again

Using @storybook/cli v7.0.0-alpha.34, here’s the full error (path to the repo is shortened to ./):

info => Starting manager..
✘ [ERROR] Invalid option in build() call: "jsxImportSource"

    ./node_modules/esbuild/lib/main.js:244:12:
      244 │       throw new Error(`Invalid option ${where}: "${key}"`);
          ╵             ^

    at checkForInvalidFlags (./node_modules/esbuild/lib/main.js:244:13)
    at flagsForBuildOptions (./node_modules/esbuild/lib/main.js:429:3)
    at buildOrServeContinue (./node_modules/esbuild/lib/main.js:1219:9)
    at ./node_modules/esbuild/lib/main.js:1146:15

ERR! TypeError: previewBuilder.bail is not a function
ERR!     at ./node_modules/@storybook/core-server/dist/cjs/dev-server.js:216:91
ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERR!     at async Promise.all (index 1)
ERR!     at async storybookDevServer (./node_modules/@storybook/core-server/dist/cjs/dev-server.js:207:28)
ERR!     at async buildDevStandalone (./node_modules/@storybook/core-server/dist/cjs/build-dev.js:129:31)
ERR!     at async fn (./node_modules/@storybook/cli/dist/generate.js:254:1900)
ERR!  TypeError: previewBuilder.bail is not a function
ERR!     at ./node_modules/@storybook/core-server/dist/cjs/dev-server.js:216:91
ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERR!     at async Promise.all (index 1)
ERR!     at async storybookDevServer (./node_modules/@storybook/core-server/dist/cjs/dev-server.js:207:28)
ERR!     at async buildDevStandalone (./node_modules/@storybook/core-server/dist/cjs/build-dev.js:129:31)
ERR!     at async fn (./node_modules/@storybook/cli/dist/generate.js:254:1900)

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

System Results of npx sb@next info:

Environment Info:

  System:
    OS: macOS 12.6
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 18.9.0 - ~/.nvm/versions/node/v18.9.0/bin/node
    npm: 8.19.1 - ~/.nvm/versions/node/v18.9.0/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Safari: 16.0
  npmPackages:
    @storybook/addon-essentials: ^7.0.0-alpha.34 => 7.0.0-alpha.34 
    @storybook/addon-interactions: ^7.0.0-alpha.34 => 7.0.0-alpha.34 
    @storybook/addon-links: ^7.0.0-alpha.34 => 7.0.0-alpha.34 
    @storybook/react: ^7.0.0-alpha.34 => 7.0.0-alpha.34 
    @storybook/react-vite: ^7.0.0-alpha.34 => 7.0.0-alpha.34 
    @storybook/testing-library: ^0.0.13 => 0.0.13 

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
joshwoodingcommented, Oct 27, 2022

@MarceloArraes 0.2.5 has been released which should fix this if you’re on v6

1reaction
shilmancommented, Oct 25, 2022

@MarceloArraes migration notes here

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#start-storybook--build-storybook-binaries-removed

We’ll be adding an automigration to do this automatically, but for now you need to do it by hand. There might be some other useful migration notes there as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] TypeError: previewBuilder.bail is not a function
If I run start-storybook , it fails the first time, works the second, but with some errors about my Flow annotations, and works...
Read more >
[Bug] TypeError: previewBuilder.bail is not a function
If I run start-storybook , it fails the first time, works the second, but with some errors about my Flow annotations, and works...
Read more >
Storybook + Vite Shows "No Preview" But still renders story
Storybook functions well despite this, but having the false negatives is not ideal. Has anyone ran into this and found a suitable reasoning ......
Read more >
Reviewing Build 565 • storybookjs/design-system - Chromatic
Error: Evaluation failed: TypeError: original is not a function at finalStoryFn ...
Read more >
Builder API - Storybook
It also provides a bail function to allow the running process to end gracefully, ... prefer-template return console.log(key + ' was not supported...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found