I am using https://github.com/srs/gradle-node-plugin to launch NPM tasks as part of my build.
But, webpack is now running out of heap space, reporting FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
I can't figure out any way to tell the the NpmTask to pass the --max-old-space-size
flag directly to node (placing it anywhere in the NpmTask args property ends up passing the flag as an argument to the npm script, which ignores it or to webpack which fails because it doesn't know the arg).
I found this github issue: https://github.com/srs/gradle-node-plugin/issues/141, but it only seems to relate to the NodeTask, not NpmTask. Looking at it, I'm thinking NpmTask needs to be extended with an extra options
property like NodeTask now has.
Is there a global config "node.js" way I can force node to use more heap space until I figure out how to get NpmTask to do what I want?
Provide the NODE_OPTIONS
environment variable when running Gradle:
NODE_OPTIONS="--max-old-space-size=1024" ./gradlew myNpmTask
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With