Error upgrading to Ghost 4.0

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be closed.

If you aren’t running the latest version of Ghost, the first thing we will ask you to do is update to the latest version of Ghost.

Ghost-CLI version: 1.16.2
Ghost version: 4.0.1 (at /var/www/ghost)

And

  • Installed via local install (ghost install)
  • Versions
    ± Node: v14.16.0
    ± OS: Ubuntu 20.04

I’ve tried to update from Ghost v3 to Ghost v4. However when I try start my instance of Ghost it gets stuck in a startup loop. The startup process looks to have an error upon which the startup process is aborted and restarted again:

Mar 16 18:17:17 blog systemd[1]: Stopped Ghost systemd service for blog: dtgocn-gb1.
Mar 16 18:17:17 blog systemd[1]: Started Ghost systemd service for blog: dtgocn-gb1.
Mar 16 18:17:20 blog node[1668]: [2021-03-16 18:17:20] #033[36mINFO#033[39m Ghost is running in production...
Mar 16 18:17:20 blog node[1668]: [2021-03-16 18:17:20] #033[36mINFO#033[39m Your site is now available on https://blog.sean-wright.com/
Mar 16 18:17:20 blog node[1668]: [2021-03-16 18:17:20] #033[36mINFO#033[39m Ctrl+C to shut down
Mar 16 18:17:20 blog node[1668]: [2021-03-16 18:17:20] #033[36mINFO#033[39m Ghost server started in 1.403s
Mar 16 18:17:21 blog node[1668]: [2021-03-16 18:17:21] #033[36mINFO#033[39m Database is in a ready state.
Mar 16 18:17:21 blog node[1668]: [2021-03-16 18:17:21] #033[36mINFO#033[39m Ghost database ready in 2.042s
Mar 16 18:17:24 blog node[1668]: [2021-03-16 18:17:24] #033[36mINFO#033[39m Ghost booted in 5.85s
Mar 16 18:17:24 blog node[1668]: [2021-03-16 18:17:24] #033[36mINFO#033[39m Adding offloaded job to the queue
Mar 16 18:17:24 blog node[1668]: [2021-03-16 18:17:24] #033[36mINFO#033[39m Scheduling job email-analytics-fetch-latest at 13 0/5 * * * *. Next run on: Tue Mar 16 2021 18:20:13 GMT+0000 (Coordinated Universal Time)
Mar 16 18:17:25 blog node[1657]: /usr/lib/node_modules/ghost-cli/lib/process-manager.js:52
Mar 16 18:17:25 blog node[1657]:         throw error;
Mar 16 18:17:25 blog node[1657]:         ^
Mar 16 18:17:25 blog node[1657]: { message: undefined }
Mar 16 18:17:25 blog systemd[1]: ghost_dtgocn-gb1-sean-wright-com.service: Main process exited, code=exited, status=1/FAILURE

This only appears to be happening under the ghost user. If I try run ghost (using ghost run), it successfully starts up. I did try run a debug and it looks like its failing on the timers:

break in internal/timers.js:562
 560           insert(timer, timer._idleTimeout, start);
 561         } else if (!timer._idleNext && !timer._idlePrev && !timer._destroyed) {
>562           timer._destroyed = true;
 563
 564           if (timer[kRefed])
debug> n
break in internal/timers.js:564
 562           timer._destroyed = true;
 563
>564           if (timer[kRefed])
 565             refCount--;
 566
debug> n
break in internal/timers.js:565
 563
 564           if (timer[kRefed])
>565             refCount--;
 566
 567           if (destroyHooksExist())
debug> n
break in internal/timers.js:567
 565             refCount--;
 566
>567           if (destroyHooksExist())
 568             emitDestroy(asyncId);
 569         }
debug> n
< /usr/lib/node_modules/ghost-cli/lib/process-manager.js:52
<         throw error;
<         ^
< Waiting for the debugger to disconnect...
< { message: undefined }

Does anyone have any ideas as to what could be causing this?

How did you install node? If you’re using nvm or similar can you check the version that each user is using? It’s possible the ghost user is not using the same version of node as your login user.

It was some back since I installed the server, but I’m pretty sure that I installed it via the Ubuntu package and have subsequently updated it. I have confirmed that the ghost user is using the same version of node, which is why this isn’t making much sense to me.

I also forgot to mention that the server instance does still run (but the error still displays) if I sudo to the ghost user and startup ghost that way (this is not ideal).

I ended up doing a clean install in the end, and that solved my issue.

Had the very same error after upgrading my Ghost (DigitalOcean Ubuntu instance).

ghost run worked perfectly, but ghost start complained about the same issue in the logfile (/var/log/syslog). I fixed it by checking the systemd service file:

/var/www/ghost/system/files/ghost_etfcapital.service

This line was wrong:

ExecStart=/usr/bin/node /usr/local/bin/ghost run

Just needed to replace /usr/local/bin/ghost by /usr/bin/ghost and it started again successfully.