Unable to upgrade Ghost due to npm version

Hi,

I am currently using Ghost 5.66.0 but am unable to update to 5.78.0.

When i try to execute the ghost-update function i am presented with a message:

Message: Ghost v5.78.0 is not compatible with the current Node version. Your node version is 16.15.0, but Ghost v5.78.0 requires ^18.12.1

I then try to use the sudo npm install -g ghost-cli@latest command but get a error:

npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/ghost-cli
npm ERR! dest /usr/lib/node_modules/.ghost-cli-no3HtXlj
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/lib/node_modules/ghost-cli' -> '/usr/lib/node_modules/.ghost-cli-no3HtXlj'

I have had a look on Ghost documentation but am not able to find a resolution.

Read this or find other tutorial to update Your node.

Hey Paul!

You will need to upgrade your node version. As of a few months ago, only Node 18 is supported: Supported node versions for self-hosted installs of Ghost

Can you tell us how you installed node on your machine? Then we can point you in the right direction.

Thank you for this. I installed Node using my Mac on a Digital Ocean droplet.

OK, so it’s a Digital Ocean droplet. What operating system is it running? Ubuntu version what?

I’m going to suggest a somewhat goofy option, but I think it’s going to save you time. Deploy a new droplet with Node 18 installed, do an export on your content from within Ghost, and copy the images folder over.

I think it’s going to be easier than trying to upgrade in situ, especially if you aren’t very tech-y.

It also has the advantage that if things go badly, you can blow away the new droplet and still have the un-upgraded droplet intact to host your stuff while you try to figure out the problem.

2 Likes

I see. You will need to log into your DigitalOcean droplet and update NodeJS there.

I assume you are using the one-click installation there? Then this should work for you:

Replace the setup_10.x with setup_18.x