How can I increase the maximum call stack size in Node.js

thomas-peter picture thomas-peter · Jul 4, 2012 · Viewed 42.7k times · Source

This is different to other questions regarding an error message in Node that reads RangeError: Maximum call stack size exceeded in that I know exactly why I'm getting this error message. It's happening because I'm recursing, recursing quite a lot in fact.

Thanks.

Answer

JohnnyHK picture JohnnyHK · Jul 4, 2012

From node --help:

node --max-stack-size=val

Update: as the comments indicate, even though the help text still lists the --max-stack-size option, in node v0.10.x you need to use --stack-size instead.

node --stack-size=val