Ghost upgrade 2.27 not working

Hello everyone, I’ve run into some issues with my Ghost install. Below are the details.

Ghost version: initial 2.25 tried to upgrade to 2.27 (this is when all things went downhill).
Config: DigitalOcean 2 GB Memory / 30 GB Disk / Ubuntu Ghost on 16.04
Node: 10.16.2
npm: 6.10.3

The main issue is that when I try to upgrade to Ghost 2.27, upon the last step when trying to restart Ghost the CPU goes haywire and at some point it crashes the process with error could not communicate with Ghost.

Tried ghost doctor not much help there. ghost log -f reports only the stuff I do when I run ghost run (which works btw), ghost start does not.

The journalctl -u ghost -n 50 reports this:

Aug 12 17:56:29 stefancosma systemd[1]: ghost.service: Service hold-off time over, scheduling restart.
Aug 12 17:56:29 stefancosma systemd[1]: Stopped Ghost systemd service for blog: .
Aug 12 17:56:29 stefancosma systemd[1]: Started Ghost systemd service for blog: .
Aug 12 17:56:32 stefancosma node[22624]: /var/www/ghost/versions/2.27.0/node_modules/knex/lib/client.js:258
Aug 12 17:56:32 stefancosma node[22624]:         return this.acquireRawConnection().then(async (connection) => {
Aug 12 17:56:32 stefancosma node[22624]:                                                       ^
Aug 12 17:56:32 stefancosma node[22624]: SyntaxError: Unexpected token (
Aug 12 17:56:32 stefancosma node[22624]:     at createScript (vm.js:56:10)
Aug 12 17:56:32 stefancosma node[22624]:     at Object.runInThisContext (vm.js:97:10)
Aug 12 17:56:32 stefancosma node[22624]:     at Module._compile (module.js:549:28)
Aug 12 17:56:32 stefancosma node[22624]:     at Object.Module._extensions..js (module.js:586:10)
Aug 12 17:56:32 stefancosma node[22624]:     at Module.load (module.js:494:32)
Aug 12 17:56:32 stefancosma node[22624]:     at tryModuleLoad (module.js:453:12)
Aug 12 17:56:32 stefancosma node[22624]:     at Function.Module._load (module.js:445:3)
Aug 12 17:56:32 stefancosma node[22624]:     at Module.require (module.js:504:17)
Aug 12 17:56:32 stefancosma node[22624]:     at require (internal/module.js:20:19)
Aug 12 17:56:32 stefancosma node[22624]:     at Object.<anonymous> (/var/www/ghost/versions/2.27.0/node_modules/knex/lib/knex.
Aug 12 17:56:32 stefancosma node[22624]:     at Module._compile (module.js:577:32)
Aug 12 17:56:32 stefancosma node[22624]:     at Object.Module._extensions..js (module.js:586:10)
Aug 12 17:56:32 stefancosma node[22624]:     at Module.load (module.js:494:32)
Aug 12 17:56:32 stefancosma node[22624]:     at tryModuleLoad (module.js:453:12)
Aug 12 17:56:32 stefancosma node[22624]:     at Function.Module._load (module.js:445:3)
Aug 12 17:56:32 stefancosma node[22624]:     at Module.require (module.js:504:17)
Aug 12 17:56:32 stefancosma systemd[1]: ghost_146-185-176-211.service: Service hold-off time over, scheduling restart.
Aug 12 17:56:32 stefancosma systemd[1]: Stopped Ghost systemd service for blog: .
Aug 12 17:56:32 stefancosma systemd[1]: Started Ghost systemd service for blog: .
Aug 12 17:56:32 stefancosma systemd[1]: Stopping Ghost systemd service for blog: ...
Aug 12 17:56:32 stefancosma systemd[1]: Stopped Ghost systemd service for blog: .

Tried searching in the nGinx logs for some clues but to no avail. If I stop ghost start when it’s stuck on starting Ghost and check ghost ls it says Ghost is running but I get a 500 Bad Gateway.

If I ghost upgrade --rollback to 2.25 it works fine. Tried ghost upgrade --force same result. Tried also downgrading the Node version to another LTS while using 2.27 but same result.

Thanks for any info that might help. I can also provide more info if the need arrises.

Thanks.

@stefcosma the error message indicates node doesn’t like this syntax:

Aug 12 17:56:32 stefancosma node[22624]:         return > this.acquireRawConnection().then(async (connection) => {
Aug 12 17:56:32 stefancosma node[22624]:                                                       ^
Aug 12 17:56:32 stefancosma node[22624]: SyntaxError: Unexpected token (

However, that syntax is valid for node 8.x and higher which is the minimum supported version of node.

Have you installed node with nvm rather than the recommended global install approach? If you have it might be worth checking which node version your Ghost install is using

@Kevin thanks for the input. The node version is 10.16.2 so I guess it’s supported, which I installed using the n package. Is there a way I can check the node version of my Ghost install?

@Kevin I got it working. Instead of using the n package to install node I used the link you shared for the recommended global install approach. After that I ran ghost update --force and it worked like a charm.

Thanks a lot for your suggestion. I’ll mark this as resolved.

Cool! :raised_hands:

FYI the reason we recommend against tools like nvm and n is for exactly this problem. Unless you set them up just right they only install alternative node versions for the current user’s shell session so you end up with system services such as the Ghost instance (often unknowingly) running against an older system version of node.

1 Like