I tried installing the latest version of Ghost on my DigitalOcean one-click droplet from last year and received the following error:
✖ Downloading and updating Ghost to v5.73.0
A SystemError occurred.
Message: Ghost v5.73.0 is not compatible with the current Node version. Your node version is 16.20.2, but Ghost v5.73.0 requires ^18.12.1
OS: Ubuntu, v22.04.3 LTS
Node Version: v16.20.2
Ghost Version: 5.68.0
Ghost-CLI Version: 1.25.2
Command: 'ghost update'
I also noticed the latest one-click image has Node.js v18 already installed. Is there a “right” way to upgrade a DigitalOcean droplet to the latest image to get this to work? I assume it may also contain updated PostgreSQL and other packages.
You could either follow a tutorial for upgrading to Node 18 on Ubuntu 22, or start over with a new droplet.
I did this recently and this is how I did it.
- Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
In a new terminal tab, ensure
nvm is installed.
command -v nvm
- Install node 18
nvm install 18.18.2
nvm use 18.18.2
Before doing any changes, backup your droplet first!
Hey, thanks for this! Could you tell me where you installed this and give me more details, please? I tried to do the same, but it still doesn’t work.
I get this error.
Are you trying to update Ghost? Which version of Ghost you are currently using? It seems that Node
18.12.1 already installed? More context of your environment and what you are trying to achieve will be helpful.
Turns out the answer was a little more complicated. Although I’m a huge fan of nvm, I decided to go the apt route outlined in a number of articles.
Most of this is captured in Ghost.org’s Supported NodeJS Versions and Compatibility guide, but it skipped a few updates like NPM and ghost-cli, and when I tried to start the service, I received a DB connection refused error. As suggested in this article, it turned out to be a problem with NodeJS v18 preferring IPv6 vs v16 which preferred IPv4. Changing the connection string in
127.0.0.1 did the trick.
Here’s the complete process that worked for me (I had to restore from snapshot several times to get it right). Power off your droplet and take a snapshot before you begin!!!
# Login as ghost user
sudo -i -u ghost-mgr
# Stop ghost
# Change database connection in ghost config from `localhost` to `127.0.0.1`
# update yarn key
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# Download and import the Nodesource GPG key
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
# Create deb repository
NODE_MAJOR=18 # Use a supported version
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
# Run update and install NodeJS
sudo apt-get update
sudo apt-get install nodejs -y
# Update NPM to the latest
sudo npm install -g firstname.lastname@example.org
# Update ghost CLI to latest version
sudo npm install -g ghost-cli@latest
# Update ghost with the same version
ghost update [version] --force # NOTE: Substitute [version] with your ghost version above
# start the service, test that it works, then stop again. If it fails here, do not proceed
# Update ghost to the latest version
Hey, thanks for the reply! Did you run the commands from
curl onwards in the