Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

previewBuilder.bail is not a function #19349

Closed
melocule opened this issue Oct 4, 2022 · 9 comments
Closed

previewBuilder.bail is not a function #19349

melocule opened this issue Oct 4, 2022 · 9 comments

Comments

@melocule
Copy link

melocule commented Oct 4, 2022

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 
@geodn
Copy link

geodn commented Oct 6, 2022

I'm encountering the same issue when upgrading storybook-addon-mock from 2.4.1 to 3.1.0. start-storybook prints this error on the first run, but on subsequent runs, the storybook starts working.

@shilman
Copy link
Member

shilman commented Oct 15, 2022

Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.38 containing PR #19405 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Oct 15, 2022
@MarceloArraes
Copy link

The error remains for me..

Copy link
Member

shilman commented Oct 25, 2022

@MarceloArraes do you have a reproduction you can share?

@MarceloArraes
Copy link

MarceloArraes commented Oct 25, 2022

The repository is trying to deploy on githubpages here:

https://github.com/MarceloArraes/react-design-system

The error is like this:

`npm run storybook

[email protected] storybook
start-storybook -p 6006

info @storybook/react v6.5.13
info
info => Loading presets
attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

info => Ignoring cached manager due to change in manager config
ERR! TypeError: previewBuilder.bail is not a function
ERR! at /home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/dev-server.js:212:26
ERR! at async Promise.all (index 1)
ERR! at async storybookDevServer (/home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/dev-server.js:203:28)
ERR! at async buildDevStandalone (/home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/build-dev.js:120:31)
ERR! at async buildDev (/home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/build-dev.js:174:5)
ERR! TypeError: previewBuilder.bail is not a function
ERR! at /home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/dev-server.js:212:26
ERR! at async Promise.all (index 1)
ERR! at async storybookDevServer (/home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/dev-server.js:203:28)
ERR! at async buildDevStandalone (/home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/build-dev.js:120:31)
ERR! at async buildDev (/home/marcelo/designSystem/react-ds/node_modules/@storybook/core-server/dist/cjs/build-dev.js:174:5)

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

Copy link
Member

shilman commented Oct 25, 2022

@MarceloArraes looks like this was only released in 7.0-alpha per my comment above. I'm not sure about the release schedule for the stable version, but maybe @IanVS or @joshwooding can comment here

If you'd like to upgrade to the alpha

npx sb@next upgrade --prerelease

@MarceloArraes
Copy link

MarceloArraes commented Oct 25, 2022

Yes yes, i'm sorry. I sended you the wrong error. When I update to your alpha i get this:
I tryed to delete node_modules, and reinstall and gone back and forth..

`[email protected] build-storybook

build-storybook

/tmp/build-storybook-3b3eca98.sh: 1: build-storybook: not found`

Copy link
Member

shilman commented 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.

@joshwooding
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants