When you perform an upgrade of your Ghost installation, you might run into a little issue towards the end of the upgrade process, specifically when you run this command:
npm install --production
This step might end abruptly with no explanation whatsoever on what is going on. On my machine, this is what happened:
root@hostname:/var/www/ghost# npm install --production extract → gunzTarPerm ▌ ╢██████████████████████████████████░░░░░░░░░░░░░░░╟ Killed root@hostname:/var/www/ghost# npm install --production cloneCurrentTree → attemp ▀ ╢████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ Killed
As you can see, even attempting to run the command again didn’t help. After a little bit of digging around, I found out that this is a RAM issue.
This happens because your system is running out of available RAM to complete this step of the upgrade. You can check your current RAM usage with this command:
If you encountered this issue, it is very likely you are very close to maxing out your RAM. If this is the case, you have two options to solve this:
- You can either increase the RAM on this machine (if you are running Ghost in a VM, that will be extremely simple)
- You can create a swap file on your machine
In my case, I am running Ghost on a DigitalOcean droplet with only 512 MB of RAM, so I decided to go with option number 2. Here is a great guide on how to configure swap space on Linux running in a DigitalOcean Droplet, there is nothing I can add to the article as it’s already excellent as it it.
FYI, the instructions worked on Ubuntu 16.04 too, and to solve this specific issue, creating a swap file of just 512 MB was enough, so there is no need for you to create a bigger one.