[Node.js] RangeError: Maximum call stack size exceeded

Tadashi Shigeoka ·  Sat, April 19, 2014

Here’s a memo on how to handle the “RangeError: Maximum call stack size exceeded” error in Node.js.

% node -v
v0.10.26

% node --v8-options | grep -B0 -A1 stack_size
  --stack_size (default size of stack region v8 is allowed to use (in kBytes))
        type: int  default: 984

Node.js version 0.10.26 has a default stack size of 984 KB.

% node -h 
...

Options:
  --max-stack-size=val set max v8 stack size (bytes)

...

The help says to specify with —max-stack-size:

node --max-stack-size=val

But for v0.10.x and later, it seems you need to use:

node --stack-size=val

Use —stack-size to specify the value.


Reference Information

What is the default stack size in Node.js? - Stack Overflow

javascript - How can I increase the maximum call stack size in Node.js - Stack Overflow

That’s all from the Gemba.