Troubleshooting

Creating a 10GB Swapfile on VPS

To resolve out-of-memory issues during resource-intensive operations like yarn install, follow these steps to create and enable a 10GB swapfile:

  1. Create the swapfile:

sudo fallocate -l 10G /swapfile

  1. Set correct permissions:

sudo chmod 600 /swapfile

  1. Set up the swap area:

sudo mkswap /swapfile

  1. Enable the swap:

sudo swapon /swapfile

  1. Make the swap permanent by adding it to /etc/fstab:

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

  1. Verify the swap is active:

sudo swapon --show

After completing these steps, your system should have an additional 10GB of swap space available. This should help prevent out-of-memory errors during resource-intensive operations like building your project. Note: Consider rebooting your VPS to ensure all changes take effect, although the swap should be immediately available after step 4.

Last updated