Upgrading ghost to 0.11.4 on Digital Ocean

While upgrading Ghost from 0.7.x to 0.11.4 I ran into some problems that were causing my site to throw 502 Service Unavailable

Seemed to be problems with the node installation and some of the errors that I felt were relevant didn't seem to help when googling for problems.

npm ERR! Failed at the ghost@0.11.4 start script 'node index'.  

node index was failing. It seemed to be a problem with sqlite3, as this error was also showing up

npm install sqlite3 --save  
Error: Cannot find module '/var/www/ghost/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node'  

Here's what ended up getting me back online. The part I was missing was cleaning out the node_modules directory.

This assumes you've installed ghost at /var/www/ghost

cd /var/www  
wget http://ghost.org/zip/ghost-latest.zip  
rm -rf ghost/core  
unzip -uo ghost-latest.zip -d ghost  
cd ghost  
chown -R ghost:ghost ghost/*  
npm cache clean  
rm -rf node_modules  
npm install --production  
service ghost restart  

Hope this helps someone!