Bob Sleys's picture

I've installed the Ghost CMS turnkey and per the instrucions I've tried to do update Ghost to the latest version but the following error.  Here is the console output below

ghost_user@Ghost-Dev ~$ ghost update

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

 

+ sudo systemctl is-active ghost_localhost
✔ Checking system Node.js version - found v16.15.0
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking free space
✔ Checking for available migrations
✖ Checking for latest Ghost version
A CliError occurred.

Message: Unable to update Ghost directly to v5.37.0. You must be on the latest v4.x to update across major versions.
Help: Run "ghost update v4" to get the latest v4.x version, then run "ghost update" to get to v5.

Debug Information:
    OS: Debian GNU/Linux, v11
    Node Version: v16.15.0
    Ghost Version: 4.47.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost update'

Additional log info available in: /opt/ghost/.ghost/logs/ghost-cli-debug-2023-03-06T16_54_14_985Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
ghost_user@Ghost-Dev ~$ ghost update v4

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

 

+ sudo systemctl is-active ghost_localhost
✔ Checking system Node.js version - found v16.15.0
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking free space
✔ Checking for available migrations
✔ Checking for latest Ghost version
✔ Release notes were not found
✖ Downloading and updating Ghost to v4.48.9
A ProcessError occurred.

Message: Command failed: yarn install --no-emoji --no-progress
warning ghost@4.48.9: The engine "cli" appears to be invalid.
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.33"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.27.0"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.31"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.34"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.3"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "@tryghost/logging@2.1.8" is incompatible with requested version "@tryghost/logging@2.1.5"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning " > bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0".
warning " > mock-knex@0.4.9" has incorrect peer dependency "knex@> 0.8 < 2.1".

yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...


Debug Information:
    OS: Debian GNU/Linux, v11
    Node Version: v16.15.0
    Ghost Version: 4.47.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost update v4'

Additional log info available in: /opt/ghost/.ghost/logs/ghost-cli-debug-2023-03-06T16_55_44_087Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
ghost_user@Ghost-Dev ~$

Here is the log file mentioned above:

Debug Information:
    OS: Debian GNU/Linux, v11
    Node Version: v16.15.0
    Ghost Version: 4.47.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost update v4'
Message: Command failed: yarn install --no-emoji --no-progress
warning ghost@4.48.9: The engine "cli" appears to be invalid.
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.33"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.27.0"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.31"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.34"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.3"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "@tryghost/logging@2.1.8" is incompatible with requested version "@tryghost/logging@2.1.5"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning " > bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0".
warning " > mock-knex@0.4.9" has incorrect peer dependency "knex@> 0.8 < 2.1".

yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...

--------------- stdout ---------------
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...


--------------- stderr ---------------
warning ghost@4.48.9: The engine "cli" appears to be invalid.
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.33"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.27.0"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.31"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.34"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.3"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "@tryghost/logging@2.1.8" is incompatible with requested version "@tryghost/logging@2.1.5"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning " > bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0".
warning " > mock-knex@0.4.9" has incorrect peer dependency "knex@> 0.8 < 2.1".

 

Forum: 
Jeremy Davis's picture

Looking at the error message, see these lines:

A CliError occurred. Message: Unable to update Ghost directly to v5.37.0. You must be on the latest v4.x to update across major versions. Help: Run "ghost update v4" to get the latest v4.x version, then run "ghost update" to get to v5.

So if you haven't already, I suspect that following that recommendation will get you further. I.e.:

su - ghost_user
ghost update v4

Unfortunately though, it seems that the upgrade to Ghost v5.x fails unless you are using MySQL v8 explicitly - see the bug on our issue tracker and/or the thread where the original discussion occurred. TL;DR as we're based on Debian (which only provides MariaDB) and Ghost now only supports MySQL strictly, we don't have any nice way to support Ghost moving forward. To be clear, you can install MySQL yourself on TurnKey (Debian) - but we can't preinstall it - due to licensing issues. Whilst MySQL itself is free open source software, Debian doesn't package it anymore, and the way to install it (using the MySQL third party apt repo) is proprietary (it explicitly includes a no-redistribution clause). So we're a bit stuck on how we can move forward with Ghost.

If you want to continue to use the TurnKey Ghost appliance, you will need to install MySQL. The Ghost forums have a thread covering how to migrate from MariaDB to MySQL on Debian.

Apologies that this is all such a pain. Personally, I think explicitly requiring MySQL is a dumb plan on the Ghost devs part (if you only support one DB backend, MariaDB would be a better choice IMO). Ubuntu is pretty much the only Linux OS that still includes actual MySQL in their main repos (most others dropped MySQL in favor of MariaDB). OTOH you could also argue that the Debian (and other distro) devs should have continued to provide MySQL - and just added MariaDB.

Bottom line, if you have only just installed Ghost and don't have any data, you may be better off choosing an alternative to TurnKey for running Ghost (sorry for the time you've spent already). If you already have data loaded and/or wish to proceed with TurnKey, then please run through the Ghost forum post linked above to migrate from MariaDB to MySQL. If you do go through that, please do report back. If you hit any issues, please feel free to post back here and I'll do my best to help out.

Bob Sleys's picture

Yes that command is in the middle there, sorry it got kind of swalled up in the form formatting.  The ghost update -v4 is whats falling.

 

However since v5 is off the table it's moot point.  I didn't know about the limitation so I guess I'll try another way.

Thanks again for your response.

Jeremy Davis's picture

Sorry that I didn't realize that the issue was running the 'ghost update v4' command. Now you mentioned it, it's obvious re-reading your OP.

I'm assuming that you've likely moved on by now, so this is probably irrelevant, but for completeness I thought I'd reply anyway. Especially if someone else comes across this issue it might be useful info?

For what it's worth, it worked for me!? And I updated to the latest v4 no worries. I'll provide more details on the steps that I took, but a bit of a google regarding the error that you received previously suggest that it may have been related to running out of RAM? I'm not sure how much RAM yours had, but mine has 2GB.

FWIW these are the steps I took to upgrade to latest v4 (v4.48.9):

apt update
apt upgrade
n 16 # update NodeJS to latest v16.x release - probably not required
su - ghost_user
ghost update v4

It did recommend that I update ghost-cli to the latest (using "npm install -g ghost-cli@latest"), which I did after the v4 update, but it didn't seem to affect anything. FYI here's the versions after this update (inc updating ghost-cli):

    OS: Debian GNU/Linux, v11
    Node Version: v16.19.1
    Ghost Version: 4.48.9
    Ghost-CLI Version: 1.19.3

Also, I did need to run some commands (suggested by ghost-cli) to fix some permissions. I assume that's because we're using the 'ghost_user' user account, but ghost itself runs as the 'ghost' user (som time ago, we used that account as well, but then heard that it's not recommended to do it that way).

Anyway, the v4 worked fine, but I stopped there and exited back to a root shell. I then followed the Ghost forum instructions for installing Oracle MySQL v8.

The Oracle MySQL install was a bit of a pain, but wasn't too bad. The only additional steps I needed to take after install was to reset the ghost DB user password (because I manually created the user and loaded the ghost DB). This is the command to do that:

ghost config set database.connection.password new_ghost_db_user_password

After doing that I logged back in as ghost_user and double checked that everything was still working (i.e. I ran "ghost start"). All appeared well, so I stopped it again and continued with the update:

ghost_user@JED-TEST-ghost ~$ ghost update
You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

+ sudo systemctl is-active ghost_localhost
✔ Checking system Node.js version - found v16.19.1
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking free space
✔ Checking for available migrations
✔ Checking for latest Ghost version

# 5.37.0

* ✨ Added document file support to the zip importer - Naz
* ✨ Added media file support to the zip importer - Naz
* 🎨 Updated Casper to v5.4.7 - Ghost CI
* 🐛 Fixed broken link filter params (#16351) - Ronald Langeveld
* 🐛 Added `undefined` error handling to failed uploads (#15982) - Ronald Langeveld
* 🐛 Fixed uploads of m4a files with audio/mp4 content type - Reupen Shah
* 🐛 Fixed failing update-check job - Naz
* 🐛 Fixed Handlebars’ asset helper for SafeString input - monkey sees

---

View the changelog for full details: https://github.com/tryghost/ghost/compare/v5.36.1...v5.37.0

✔ Fetched release notes
✔ Downloading and updating Ghost to v5.37.0

Checking theme compatibility for Ghost 5.37.0

✔ Your theme is compatible.

You can also check theme compatibility at https://gscan.ghost.org

Please review the full list of breaking changes at https://ghost.org/docs/changes/

? Are you sure you want to proceed with migrating to Ghost 5.37.0? Yes
✔ Updating to a major version
✔ Linking latest Ghost and recording versions
✔ Removing old Ghost versions

TBH, I'm not sure why it says that I still have an "outdated version of Ghost-CLI"? Becasue I definitely updated it?! But it doesn't seem to cause any issues, so I didn't worry about that.

I did need to run this (again) after the update before ghost would start:

sudo find ./ ! -path "./versions/*" -type f -exec chmod 664 {} \;

But otherwise all seemed well:

ghost_user@JED-TEST-ghost ~$ ghost start

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

+ sudo systemctl is-active ghost_localhost
✔ Checking system Node.js version - found v16.19.1
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_localhost
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.19.1
+ sudo systemctl start ghost_localhost
+ sudo systemctl is-enabled ghost_localhost
✔ Starting Ghost: localhost

------------------------------------------------------------------------------

Your admin interface is located at: 

    https://www.example.org/ghost/
Jeremy Davis's picture

I did a bit more digging into why the ghost-cli wasn't getting updated, even after runing the required command. It turns out that the version being used (when you run 'ghost command') is owned by root, so I assume that it's just doing a local update, rather than updating the whole system. Re-running that as root resolve the issue. I.e.:

root@JED-TEST-ghost ~# npm install -g ghost-cli@latest 

added 65 packages, removed 8 packages, changed 419 packages, and audited 485 packages in 46s

44 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (4 moderate, 4 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice 
npm notice New major version of npm available! 8.19.3 -> 9.6.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.1
npm notice Run npm install -g npm@9.6.1 to update!
npm notice 
root@JED-TEST-ghost ~# su - ghost
ghost@JED-TEST-ghost ~$ ghost -v

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

Ghost-CLI version: 1.24.0
Ghost version: 5.37.0 (at ~)

Add new comment