Upgrading to v3 failure

Upgrading from 2.31.1 and trying to get to 3.0. When I update ghost-cli, everything shows it upgrading to 1.12.0, but when I go to run the ghost update, I get this:

fomu65@HGC3a:/var/www/tedhardy2$ 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.

–	sudo systemctl is-active ghost_tedhardy-com
✔ Checking system Node.js version
✔ 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 for available migrations
✖ Checking for latest Ghost version
A CliError occurred.

Message: You are about to migrate to Ghost 2.0. Your blog is not on the latest Ghost 1.0 version.
Help: Instead run "ghost update --v1".

Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v10.17.0
    Ghost-CLI Version: 1.11.0
    Environment: production
    Command: 'ghost update'
A promise was rejected but did not have a .catch() handler:
Error: EACCES: permission denied, mkdir '/home/fomu65/.ghost/logs'
    at Object.mkdirSync (fs.js:757:3)
    at Object.mkdirsSync (/usr/local/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
    at System.writeErrorLog (/usr/local/lib/node_modules/ghost-cli/lib/system.js:359:12)
    at UI.error (/usr/local/lib/node_modules/ghost-cli/lib/ui/index.js:406:44)
    at Function._run (/usr/local/lib/node_modules/ghost-cli/lib/command.js:183:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
/usr/local/lib/node_modules/ghost-cli/lib/bootstrap.js:27
    throw reason;
    ^

Error: EACCES: permission denied, mkdir '/home/fomu65/.ghost/logs'
    at Object.mkdirSync (fs.js:757:3)
    at Object.mkdirsSync (/usr/local/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
    at System.writeErrorLog (/usr/local/lib/node_modules/ghost-cli/lib/system.js:359:12)
    at UI.error (/usr/local/lib/node_modules/ghost-cli/lib/ui/index.js:406:44)
    at Function._run (/usr/local/lib/node_modules/ghost-cli/lib/command.js:183:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
fomu65@HGC3a:/var/www/tedhardy2$ which ghost
/usr/local/bin/ghost

From what I’m seeing from others getting upgrade failures, I’m betting this is a path issue but despite my best efforts, I cannot figure out what is going on. When I check out /usr/local/bin, there is an alias there from ghost to the path showing in the errors. I can’t locate what’s going on. Any suggestions would be greatly appreciated.

Not sure it matters, but I’m actually running two sites on this single DigitalOcean host. Tedhardy.com and highgravityconsulting.com. Not sure if that makes a difference or not.

Seems like you have permission errors - can you try ghost doctor?

I agree - looks like you have a permission problem… and
I would strongly recommend that you take note of the very first suggestion:

sudo npm install -g ghost-cli@latest

especially as the old version you are using says:

Message: You are about to migrate to Ghost 2.0. 

You did spot the 2.0 ??

Gave me a fright when I saw it - FYI I have upgraded one blog from 2.26 to 3.0 with only minor issues. Holding off on the rest for a week while the dust settles.

Ah - rereading your original post - looks like you tried to upgrade to latest ghost-cli - but it seems to have failed so you are still running outdated ghost-cli.

And you need to look in your home folder at the .ghost/ directory to find the permissions issue.

Did you remember to sudo the npm update?

sudo npm install -g ghost-cli@latest

Thanks for the thoughts.

Yes, I did sudo on updating ghost-cli.

Ghost doctor returns all green checkmates, except validating confígs, which returns a question mark?

so:

  1. first step - get ghost-cli updated. Redo the sudo npm install -g ghost-cli@latest and carefully check that it works.
  2. second step - check the permissions on your ~/.ghost folder find ~/.ghost -ls

Running ghost -v should give you a CLI version of at least 1.12.0. If you don’t see this, that means you have multiple installations of the CLI on your system

Thanks all. I have fixed the permissions issue on my ~/.ghost folder. All good there. Still can’t get ghost-cli updated. I think @vikaspotluri123 is right, but cannot find where the other version is. Here’s what I get:

sudo npm install -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost+ ghost-cli@1.12.0
updated 1 package in 9.899s
fomu65@HGC3a:~$ ghost -v
Ghost-CLI version: 1.11.0

What’s the output of which ghost, please?

/usr/local/bin/ghost

So, you can see that when you installed ghost cli it output this path:

But which ghost is outputting a different path

/usr/local/bin/ghost

You could try editing your path variable to change the order of these two locations, or you can try removing the file at the latter path.

1 Like

Thanks @Hannah. Knew I was missing something obvious, but couldn’t figure it out. I looked at that and missed it.

Took your advice and changed path variable to switch the two locations. No idea why, but that didn’t work. Then moved ghost to ghost.bak in /usr/local/bin/ghost, and I get a file not found error when I run ghost -v. I put the file back and get v1.11. Clearly doing something wrong. :frowning:

It’s really hard to debug things like this from a far. I can tell you what’s wrong, but how to fix it depends!

npm bin --global will tell you what npm thinks is the bin path echo $PATH will tell you what the $PATH variable is for the current user. Maybe try calling that with different users, or with sudo, to try to debug where the “switch” happens and how various changes get you closer or further away from the right config.

Essentially though, you have a program called ghost installed at more than one location. npm is installing to /usr/lib/node_modules/ghost-cli/bin/ghost AND symlinking to /usr/bin/ghost.

But the first program detected in your path with the name Ghost is /user/local/bin/ghost.

It may also be possible to configure the npm bin path, but that shouldn’t be necessary.

By design on Linux, /usr/local/bin takes precedence over /usr/bin - so switching the order in $PATH might break something else. Local is specifically used to override commands when you have a special need for this specific host.

You would be better to find out who / why the local version was installed - and get them to remove it. ls -al /usr/bin/ghost might give you a hint.

As a temporary work-around, you could just move the local version aside and then restore it after the upgrade. e.g. before:

sudo mv /usr/local/bin/ghost /usr/local/bin/ghost.temp-rename

after upgrade:

sudo mv /usr/local/bin/ghost.temp-rename /usr/local/bin/ghost

This might let you upgrade now - but just defers resolution of the real problem and possibly other issues.

I have the same problem, and that is because the ghost-cli version is too old. You could use

sudo npm install -g ghost-cli@latest

Update ghost-cli to the latest version.

That is how i solve this.

Thank you all for the assistance. I put this off a couple weeks doing other things, but now back to it.

@Jeff your workaround worked! the reason my server is set up this way is that I’ve been rolling it forward for something like 6 years now and some of the really terrible configs I put in place forever ago are still in place. my intent is to export everything and start fresh, just haven’t gotten around to it yet. Probably going to wait till 20.04.01 LTS is out and do it then, but that’s too long to wait for Ghost v3!

Once again, appreciate everything you all do to make Ghost so great!