There are multiple methods you can use to update Node.js on your older Ghost Droplet. Here I'll explain how to do it using the Nodesource Apt repository. Tools like
nvm could also be used, but I've chosen to use the repository in order to be consistent with how newer Ghost Droplets are created and so that you can receive ongoing updates to Node.js via your package manager as you apply normal updates.
First, confirm that you are using an older version that was installed from source. Run:
If the output is
/usr/local/bin/node as opposed to simply
/usr/bin/node, then you are using an older version.
To add the Nodesource repository and install the latest LTS version of Node.js, run:
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
- sudo apt-get install -y nodejs
After installation completes, verify that you have an up-to-date Node.js by running:
Next, we'll need to update the Upstart script that is used to run Ghost. Temporarily shutdown Ghost with the command
sudo service ghost stop Now, edit the file
/etc/init.d/ghost and replace all instances of
/usr/bin/npm When you are done, it should look like:
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
exec /usr/bin/npm start --production
pre-stop exec /usr/bin/npm stop --production
Now, restart Ghost and confirm it is running as expected:
Finally, after you've made sure that everything is successfully installed and running, you can delete both