Update the Node.js version on your Digital Ocean droplet to support Ghost 3.0.0.

If you are running an older Ghost installation on Ubuntu 18.04 using Digital Ocean's one-click app, there is a chance that it was installed with Node.js 8. If you're anything like me, when you went to update to Ghost 3.0.0, it failed because your Node.js version was too old. 😭

Luckily it is easy to update.

Confirm which version of Node.js you are running.

which nodejs

The output should be something like /usr/bin/node. If it's /usr/local/bin/node, then you are using a much older version of the Ghost droplet image. *

Add the Nodesource repository anmd install the latest Node.js 10 LTS version.

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

Confirm the Node version.

/usr/bin/node --version

You're done! You should be able to proceed with updating Ghost.

Older Ghost Droplets

* If your installation said /usr/local/bin/node, then there is one last step to complete. We need to modify the Ghost upstart script to use the updated version of Node.js.

First stop Ghost from running with ghost stop.

Next, edit the /etc/init.d/ghost file and replace all instances of /usr/local/bin/npm with /usr/bin/npm. It should look similar to this:

description "Ghost: Just a blogging platform"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectedly trigger a respawn
respawn

setuid ghost
setgid ghost
env NODE_ENV=production
chdir /var/www/ghost

exec /usr/bin/npm start --production

pre-stop exec /usr/bin/npm stop --production

Run ghost start to get Ghost back up and running again.