Skip to content

Commit 7124655

Browse files
authored
Instructions about node heap (GoogleChrome#7539)
1 parent 78701c4 commit 7124655

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,26 @@ Set `ELEVENTY_ENV=prod` to force production builds. This is the default when
7878
running "stage" or "deploy". No other options for `ELEVENTY_ENV` are supported,
7979
although our Eleventy site config will default to 'dev' if unspecified.
8080

81+
The production build currently requires a _lot_ of memory, to the point where
82+
`node` might exit with errors along the line of
83+
84+
```sh
85+
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
86+
87+
v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
88+
```
89+
90+
The exact amount of heap space required varies from computer to computer and version
91+
of `node`. If you need a local production build, but run out of memory, you can
92+
increase the heap size by adding `--node-options '--max_old_space_size=8192'` (to
93+
[assign 8gb of heap space](https://stackoverflow.com/questions/48387040/how-do-i-determine-the-correct-max-old-space-size-for-node-js/48392705#48392705))
94+
to the [`npm` command](https://docs.npmjs.com/cli/v8/using-npm/config#node-options),
95+
prior to `run`. For instance:
96+
97+
```sh
98+
ELEVENTY_ENV=prod npm --node-options '--max_old_space_size=8192' run build
99+
```
100+
81101
## Staging 🕺
82102

83103
When you send in a pull request it will be automatically staged for you. Keep an

0 commit comments

Comments
 (0)