Storybook running out of memory when building
See original GitHub issueDescribe the bug
After upgrading from 6.0.12 to 6.0.21 when running npx http-server ./lib/storybook -p 8082 -a localhost
at 69% built I get: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Note: in the past we have had the same problem on 5.x versions, which were resolved by upgrading node.
I appreciate this lacks a lot of context, and it’s a private repo so I’m unable to share as is, but if anyone is able to point me in the direction of diagnosing or potential causes, that would be of great help.
We are running typescript.
To Reproduce Steps to reproduce the behavior:
Run npx http-server ./lib/storybook -p 8082 -a localhost
Expected behavior Builds as expected
System:
Please paste the results of npx sb@next info
here.
System:
OS: Windows 10 10.0.19041
CPU: (8) x64 Intel® Core™ i7-8650U
Binaries:
Node: 12.16.1 - C:\Program Files\nodejs
npm: 6.13.4 - C:\Program Files\nodejs\n
Browsers:
Chrome: 84.0.4147.135
Edge: Spartan (44.19041.423.0), Chromiu
npmPackages:
@storybook/addon-actions: 6.0.21 => 6.0
@storybook/addon-essentials: 6.0.21 =>
@storybook/addon-knobs: 6.0.21 => 6.0.2
@storybook/addon-links: 6.0.21 => 6.0.2
@storybook/addon-toolbars: 6.0.21 => 6.
@storybook/addons: 6.0.21 => 6.0.21
@storybook/react: 6.0.21 => 6.0.21
@storybook/theming: 6.0.21 => 6.0.21
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:25 (5 by maintainers)
This is an issue when using storybook in a monorepo (a repo containing many individual packages and their own node_modules folders). It seems that when using default configs, storybook runs out of memory because it is scanning all of the node_modules sub folders. If I remove all the node_modules folders, it works fine. Is there a recommended way to include storybook in a monorepo? I’m thinking I’ll have to use a custom webpack config that excludes the appropriate folders.
Even with 6GB of RAM in docker, the build still fails: