Issue with npm and 5$ DigitalOcean VPS

by Grégoire MOLVEAU

13 November 2015 · 121 words · 1 minute read npm ghost 

I had an issue with my docker ghost blog, it kept being killed for no reason…

GET /robots.txt 200 16.540 ms - -
GET / 200 160.595 ms - -

npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.10.40
npm ERR! npm  v2.14.1

So I tried to debug npm and found that it has an issue with low ram, so a solution is to increase the swap size.

Here’s how to fix it :

swapoff -a
dd if=/dev/zero of=/swapfile bs=1024 count=1024k 
chmod 0600 /swapfile
mkswap /swapfile
nano /etc/fstab

and add this line :

/swapfile swap swap defaults 0 0

then re-enable the swap.

swapon -a

AND you’re good to go :)