Ghost Blog: Issues Updating Node Version

358 Views Asked by At

I am attempting to update the Node version to the latest supported version at the time of writing; v18. I have followed the instructions exactly step by step. However, despite this, it installed v20.9.0 instead and I can't find a way to downgrade it to the supported v18 so I can go ahead with the the Ghost updates.

I am running Ghost on an Ubuntu 22.04 LTS server.

It's really strange as well because although when running the command node -v it displays that I have managed to upgrade it to v18. However, as you can see in the screenshot below when I try to the run ghost update, I get the following error message.

enter image description here

I followed the instructions on the official documentation here: https://ghost.org/docs/faq/node-versions/

1

There are 1 best solutions below

0
On

I'll have to admit that a while ago i ran into similar issues. The number one thing is to ensure you are running a supported LTS version of nodejs.

In my case i didnt and also dont run Ghost on recommended Ubuntu but on CentOS stream.

I'll write/paste below my actions, you'll want to convert them to the Ubuntu/dpkg equivalent.

Cleanup

dnf module list nodejs

Last metadata expiration check: 1:40:38 ago on Sun 19 Nov 2023 09:08:06 AM CET.
CentOS Stream 9 - AppStream
Name                                Stream                              Profiles
nodejs                              18                                  common [d], development, minimal, s2i
nodejs                              20 [e]                              common [d], development, minimal, s2i

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

As you can see i have the wrong versions enabled

yum remove nodejs
dnf module reset nodejs

Install

dnf module enable nodejs:18

yum install nodejs
Last metadata expiration check: 1:45:13 ago on Sun 19 Nov 2023 09:08:06 AM CET.
Dependencies resolved.
Installing:
 nodejs                                    x86_64                          1:18.14.2-2.module_el9+307+7e5e4074

I got a warning about an npm update, which didnt want to install, but thats 'fine' with me for now :)

Install ghost

npm install ghost-cli@latest -g

Ghost blog

Be sure to be the web-user whichever you use and be in the ghostblog websites path

/usr/local/bin/ghost check-update
/usr/local/bin/ghost backup
/usr/local/bin/ghost update

# Downloading and updating Ghost to v5.74.0

And its all done.