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

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:

> sbtest@0.1.0 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! sbtest@0.1.0 build-storybook: `build-storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sbtest@0.1.0 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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 20
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@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!

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! xyz@1.0.0 build-storybook: `build-storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xyz@1.0.0 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

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.