I have 512MB RAM machine with 512MB of swap memory available (basically it is heroku 7$ tier). Total is 1GB. My npm build takes 1.5 GB of RAM locally (npm build exits with MemoryError on heroku), I don't want to include /build folder into git and run builds locally. What are workarounds for this? Maybe any node flags?
you can increase your ram to get server working via swap memory (with at least 2GB to get webpack working)
Example with a 4.3 GB swap:
sudo dd if=/dev/zero of=/swapfile bs=128M count=32
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
After that your server will have 4.3GB more ram (stored at hard drive and used virtually as ram)
To use the swap (and increase the ram) at every machine start, add it at /etc/fstab
/swapfile swap swap defaults 0 0
For more information about swap creation and configuration: https://linuxize.com/post/create-a-linux-swap-file/