Node JS – Hot to solve: code: ‘ENOMEM’, errno: ‘ENOMEM’, syscall: ‘spawn’

If with node.js you get the bug ” code: ‘ENOMEM’, errno: ‘ENOMEM’, syscall: ‘spawn’ ” you can create a swap file to solve the problem.

Here is how to create a swap of 2GB on ubuntu:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

#Make it persistent after reboot: 
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab

Leave a comment

Your email address will not be published. Required fields are marked *