Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 912
Andrew Carreiro Avatar asked Jan 13 '23 01:01

Andrew Carreiro


2 Answers

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...

like image 174
Gilad Peleg Avatar answered Jan 25 '23 07:01

Gilad Peleg


Install grunt-cli locally with npm install grunt-cli then call it locally with:

node --max-stack-size=val ./node_modules/.bin/grunt

Although likely you're getting that error because of an infinite recursion that should be fixed.

like image 38
Kyle Robinson Young Avatar answered Jan 25 '23 07:01

Kyle Robinson Young