How to fix compile error on VPS : virtual memory exhausted: Cannot allocate memory

The root cause is no swap on your vps.
Let's mkswap by ourself.

errong_leng@vvs:~$ sudo su -
root@vvs:~# umask 077
root@vvs:~# mkdir /usr/img/
root@vvs:~# dd if=/dev/zero of=/usr/img/swap bs=1024 count=2048000
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB, 2.0 GiB) copied, 54.9435 s, 38.2 MB/s
root@vvs:~#  mkswap /usr/img/swap      
Setting up swapspace version 1, size = 2 GiB (2097147904 bytes)
no label, UUID=c435f1d9-9b3a-40a8-8624-b7a09adca9d5
root@vvs:~# swapon /usr/img/swap

Once you do not need swap, you can delete it.
Since it will use about 2G of your vps disk.
#swapoff /usr/img/swap
#rm /usr/img -rf

Comments

Popular posts from this blog

react-native run-android : do not build/update modified code(App.js)

react-native run-android : sun.security.provider.cert path.SunCertPathBuilderException : unable to find valid certification path to req uested target

How to fix error : no module named sendgrid when try to use sendgrid python lib in PHP.