Question: 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: 
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

```
In node version 5 and 6, I have verified that the option to set maximum stack size is "--stack\_size" (with an underscore):

```
$  node --v8-options
[...]
--stack_size (default size of stack region v8 is allowed to use (in kBytes))
      type: int  default: 984

```

To increase the maximum stack size, just issue something like:

```
$ node --stack_size=1200

```

As noted by others, be aware that increasing this value may lead to a segmentation fault. The maximum safe value for me with version 6 is 1361, but seems higher with version 5.

Looking at the bigger picture, increasing stack size may not solve all your issues. When writing recursive functions in node, your best strategy is to write them in a [tail-recursive](http://medium.com/@dai_shi/tail-call-optimization-tco-in-node-v6-e2492c9d5b7c) [manner](http://benignbemine.github.io/2015/07/19/es6-tail-calls/), since version 6 supports proper tail calls. This will eliminate stack size overflows.

**Update**: the comment about tail calls doesn't apply to Node.js anymore. They've removed tail-call optimization from the engine in version 8. See [this answer](https://stackoverflow.com/a/42788286/5045563) for some more info.