Jenkins service stops completely during a node js build, getting a 502 bad gateway with an nginx setup on Ubuntu
As explained in this thread you can increase the memory in the /etc/default/jenkins
where you can adjust the following flag
JAVA_ARGS="-Xmx256m" # Choose your desired memory instead of 256