eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.25k stars 871 forks source link

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #909

Closed vijay-yadav-3 closed 4 years ago

vijay-yadav-3 commented 4 years ago

While running the ng build command from pom.xml i am facing heap memory issue. How can I allocate memory to this plugin as it will install npm in project directory. I think I have to add it in pom.xml only but what would be the exact command. Below is my error.

[INFO] <--- Last few GCs ---> [INFO] [INFO] [1067:0x34168e0] 109464 ms: Scavenge 1348.9 (1423.1) -> 1348.4 (1423.6) MB, 3.1 / 0.0 ms (average mu = 0.298, current mu = 0.287) allocation failure [INFO] [1067:0x34168e0] 109469 ms: Scavenge 1349.2 (1423.6) -> 1348.7 (1424.1) MB, 3.0 / 0.0 ms (average mu = 0.298, current mu = 0.287) allocation failure [INFO] [1067:0x34168e0] 109475 ms: Scavenge 1349.4 (1424.1) -> 1348.9 (1425.1) MB, 3.0 / 0.0 ms (average mu = 0.298, current mu = 0.287) allocation failure [INFO] [INFO]

[ERROR] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

eirslett commented 4 years ago

I think your problem is with node.js, not with this plugin. I'm sure the same thing happens when you run npm directly?

vijay-yadav-3 commented 4 years ago

I have another program with same pom config and there it does not throw any error, there build is successful.

It is installing node also from this plugin right? install-node-and-npm. Correct me if i am wrong, i am quiet new in all this.

And if the problem is with node.js do you have any idea or reference how to resolve it.

eirslett commented 4 years ago

Which version of node.js and npm? Maybe try a newer version?

vijay-yadav-3 commented 4 years ago
v10.16.3 6.9.0

This was added in pom.xml.

When i see about this issue people who run ng build use some more arguments such as --max_old_space_size=8048 to increase it manually. Can we do it here?

eirslett commented 4 years ago

I'm sure you can do the same, yes. Also, try using node v12.8.1 which is a newer (and also stable) version.

vijay-yadav-3 commented 4 years ago

Thanks man, When i updated the node version it started taking the build.