Hey guys, I am trying to do a bench update and the following errors keeps popping up at different stages of the build … has anyone encountered this issue before ?
yarn run v1.21.1
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js
Building frappe assets...
✔ Built js/dialog.min.js
✔ Built js/modules.min.js
✔ Built js/checkout.min.js
✔ Built js/social.min.js
✔ Built js/web_form.min.js
✔ Built js/chat.js
✔ Built js/list.min.js
✔ Built css/frappe-rtl.css
✔ Built css/printview.css
✔ Built css/module.min.css
✔ Built css/form.min.css
✔ Built css/list.min.css
✔ Built css/report.min.css
✔ Built frappe/css/email.css
Error: spawn ENOMEM
✔ Built js/bootstrap-4-web.min.js
internal/child_process.js:313
throw errnoException(err, 'spawn');
^
Error: spawn ENOMEM
at ChildProcess.spawn (internal/child_process.js:313:11)
at exports.spawn (child_process.js:508:9)
at Object.exports.fork (child_process.js:109:10)
at ChildProcessWorker.initialize (/opt/erpnext/frappe12/apps/frappe/node_modules/jest-worker/build/workers/ChildProcessWorker.js:137:44)
at ChildProcessWorker.onExit (/opt/erpnext/frappe12/apps/frappe/node_modules/jest-worker/build/workers/ChildProcessWorker.js:263:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
I opened several ports, 80, 8000, 443, 3306, but the error is the same. The difference is the error is appearing later in the build now…
After reading a bit more it seems there’s an issue with node9 as it’s running out of memory. I am running on a VPS with 2GB memory… does erpnext need more than that ?
SOLUTION:
Build your swap file and make it to turn on automatically on server reboot.
Found some context for those who do not know how to build a swapfile on a linux server environment. Proceed with Caution. Must be run as root or sudo each command. This example sets up a 2GB swap file and only as an emergency buffer when out of memory.
install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | tee -a /etc/fstab
sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | tee -a /etc/sysctl.conf
If done step by step:
In the shell you have opened to your droplet, do the following:
You will need to be root for much of this, so either be root or sudo -s before running these commands! Don’t forget to exit root afterwards.