Andrew Carreiro Andrew Carreiro - 1 year ago 73
Node.js Question

Changing --max-stack-size for grunt task

I'm running into the following error in my GruntJS script:


Maximum call stack size exceeded"


What's the proper syntax for invoking the node flag
--max-stack-size=
in my grunt command so I can set aside a larger amount of memory for the stack?

Answer Source

Unless you are doing some very high-level programming in GruntJS I think you may have a cyclic task registered.

If you name a task the same name as plugin it will run an infinite amount of times:

grunt.registerTask('uglify', ['uglify'])

This results in the task calling itself.

In order to verify what you're doing, run the grunt with --verbose (or --v) command to see what grunt is running.

For instance run grunt uglify --v and notice how many times it runs. This can be fixed easily by changing the task name to something else.

If however you're sure of what you're doing run grunt with --max-stack-size=10000 or whatever...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download