Storybook: Cannot build production Storybook: UnhandledPromiseRejectionWarning: [object Object]

Created on 29 Apr 2020  路  15Comments  路  Source: storybookjs/storybook

Describe the bug
The development storybook server is perfectly working. But when trying to build the production storybook, We are getting an error with no debug information, UnhandledPromiseRejectionWarning: [object Object]. It seems to be realted with the Terser plugin?

Here is the full error:

> [email protected] build-storybook E:\Documentos\Trabajo\Acid Tango\Libeen\sbtest
> build-storybook

info @storybook/react v5.3.18
info
info clean outputDir..
info => Copying prebuild dll's..
info => Building manager..
info => Loading manager config..
info => Loading presets
info => Compiling manager..
ERR! => Failed to build the manager
ERR! vendors~main.f255fd5eb8416a93fef7.bundle.js from Terser
ERR! undefined
(node:22996) UnhandledPromiseRejectionWarning: [object Object]
(node:22996) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:22996) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-storybook: `build-storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\danie\AppData\Roaming\npm-cache\_logs\2020-04-29T10_06_55_123Z-debug.log

I think it might be related with the usage of Next. I've created a new project using CRA the build of the production storybook doen't fail.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new next application with npx create-next-app with default template
  2. Enter the directory
  3. Initialize storybook npx -p @storybook/cli sb init
  4. Build the production storybook npm run build-storybook

You should be getting the previous error.

I've also created this repository that reproduces the error.

Expected behavior
I expect the static files to get built

System:
We have tested this error in several machines:

Environment Info:

  System:
    OS: Windows 10 10.0.18362
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
  Binaries:
    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
    npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    @storybook/addon-actions: ^5.3.18 => 5.3.18
    @storybook/addon-links: ^5.3.18 => 5.3.18
    @storybook/addons: ^5.3.18 => 5.3.18
    @storybook/react: ^5.3.18 => 5.3.18
Environment Info:
  System:
    OS: Windows 10 10.0.17763
    CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
  Binaries:
    Node: 12.10.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - C:\Program Files\nodejs\yarn.CMD
    npm: 6.10.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.831.0
  npmPackages:
    @storybook/addon-actions: ^5.3.18 => 5.3.18
    @storybook/addon-links: ^5.3.18 => 5.3.18
    @storybook/addons: ^5.3.18 => 5.3.18
    @storybook/react: ^5.3.18 => 5.3.18
Environment Info:
  System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
  Binaries:
    Node: 12.13.1 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Browsers:
    Safari: 13.1
  npmPackages:
    @storybook/addon-actions: ^5.3.18 => 5.3.18
    @storybook/addon-links: ^5.3.18 => 5.3.18
    @storybook/addons: ^5.3.18 => 5.3.18
    @storybook/react: ^5.3.18 => 5.3.18
babel / webpack build-storybook compatibility with other tools inactive question / support

Most helpful comment

@DanielRamosAcosta I tried your your repo and was able to repro. Then I did the same thing in yarn, which generated a new lock file, and now it doesn't repro. Hope that helps narrow it down!

All 15 comments

Possibly related? #10505

Hellowdy. I had the same problem. Getting rid of @storybook/preset-typescript helped me to overpass it. Good luck.

Hey @shilman, it might be, but the webpack config is managed by Next not by us 馃槙

@TheSp00k We are using TypeScript in our main project with Typescript, but we don't have that preset installed.

Besides, in the example repo we have created we don't have that plugin 馃槙

@DanielRamosAcosta I tried your your repo and was able to repro. Then I did the same thing in yarn, which generated a new lock file, and now it doesn't repro. Hope that helps narrow it down!

Yes, with yarn it seems to work @shilman!

I'm having the same issue. I tried yarn and it still gave me the same error. We are not using Typescript but we are using Next.js

nfo => Compiling manager.. ERR! => Failed to build the manager ERR! vendors~main.5ee013298d65e55f6fd7.bundle.js from Terser ERR! undefined (node:7945) UnhandledPromiseRejectionWarning: [object Object] (node:7945) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:7945) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. error Command failed with exit code 1.

Any progress on this? Having the same error here on a next.js project.

No progress, but we're chatting with the next.js team to get official storybook support via a preset, so that should be a huge boost for all next.js users.

The issue for me appeared to be with using terser-webpack-plugin v3 - downgrading to version 2.3.6 fixed it. I'm using a custom Webpack configuration rather than Next.js - removing minification from my custom config and letting Storybook take care of it also fixed the issue.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

I have the same error, haven't found it why, tried upgrading all my npm modules to latest but did not help:

$ npm run build-storybook

> build-storybook

info @storybook/react v5.3.19
info
info clean outputDir..
info => Copying prebuild dll's..
info => Building manager..
info => Loading manager config..
info => Loading presets
info => Compiling manager..
ERR! => Failed to build the manager
ERR! vendors~main.ecb8a10236cc8dbcfbb3.bundle.js from Terser
ERR! undefined
(node:38911) UnhandledPromiseRejectionWarning: [object Object]
(Use `node --trace-warnings ...` to show where the warning was created)
(node:38911) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38911) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-storybook: `build-storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yyy/.npm/_logs/2020-07-28T14_40_05_137Z-debug.log

I have the same error, haven't found it why, tried upgrading all my npm modules to latest but did not help:

$ npm run build-storybook

> build-storybook

info @storybook/react v5.3.19
info
info clean outputDir..
info => Copying prebuild dll's..
info => Building manager..
info => Loading manager config..
info => Loading presets
info => Compiling manager..
ERR! => Failed to build the manager
ERR! vendors~main.ecb8a10236cc8dbcfbb3.bundle.js from Terser
ERR! undefined
(node:38911) UnhandledPromiseRejectionWarning: [object Object]
(Use `node --trace-warnings ...` to show where the warning was created)
(node:38911) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38911) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-storybook: `build-storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yyy/.npm/_logs/2020-07-28T14_40_05_137Z-debug.log

Same issue here.

Try upgrading to 6.0 RC?

npx sb@next upgrade --prerelease
Was this page helpful?
0 / 5 - 0 ratings