Upgrade to Ghost v4, but a lot of 503 error

Can you post your systemd configuration please? Do you have any special handling for managing node versions, like nvm?

@naz Before I upgrade to Ghost v4, ghost start is working well. Now, I am in Ghost v4, ghost start works failed. I try to ghost run to run Ghost in development, but failed again:

[myghostuser@iZ ghost]$ ghost run -D
The `ghost run` command is used by the configured Ghost process manager and for debugging. If you're not running this to debug something, you should run `ghost start` instead.
+ sudo node current/index.js
sudo: unable to execute /root/.nvm/versions/node/v12.18.2/bin/node: Permission denied

[myghostuser@iZ ghost]$ sudo node current/index.js
async function initDatabase({config, logging}) {

SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/www/ghost/versions/4.0.1/ghost.js:19:5)

Can you please try a fix suggested here - 502 errors after upgrading to Ghost 4 - #9 by DanieleSalatti. Let me know if this solves the problem!

Not Working for me… basically I have only this part of code there
> [Unit]
> Description=Ghost systemd service for blog: opcije-com
> Documentation=https://ghost.org/docs/
> [Service]
> Type=simple
> WorkingDirectory=/var/www/ghost
> User=999
> Environment=“NODE_ENV=production”
> ExecStart=/usr/bin/node /usr/bin/ghost run
> Restart=always
> [Install]
> WantedBy=multi-user.target

@naz I did not configure special item in systemd, it’s default setting by Ghost:

Description=Ghost systemd service for blog: halfrost-com

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


My node version have changed to lts(v.14.16.0), but it is still not working. Maybe the solution does not solves the problem for us.

Reading this thread and 502 errors after upgrading to Ghost 4 - #13 by Hannah

From what I can tell, everyone affected is on Node v14, and the problem is not with Node v14 itself but rather with how Node has been updated meaning Ghost is getting two different node versions.

We know the CLI is not good at catching and making these issues visible right now and it’s something we’re looking into to try to help.

If you are using nvm to manage Node, please make sure you’ve read this: Using nvm with local and production Ghost installs

If you are updating Node, it’s a really good idea to do this separately to updating Ghost to 4.0.

My recommendation for anyone updating is to do the following:

  • ghost version to get your current Ghost version
  • update node
  • run ghost update [ghost version] --force to do a reinstall of the current Ghost version
  • check everything is ok
  • now run ghost update to update Ghost itself

If you’ve already done the update and are running into problems, it will be easier to help if everyone starts their own threads.

Please share the normal debug info and also:

  • did you just update node? If so how?
  • output from which node
  • output from node --version
  • your systemd file
  • :warning: Important, take care: The output from running node --version with the full path from Exec Start in systemd, so if your ExecStart says ExecStart=/usr/bin/node /usr/bin/ghost run then share the output from running /usr/bin/node --version`

This should be a good start.

This thread was started by @halfrost and we will try to help them here. Please can anyone else who is still having problems start their own thread sharing the info I have asked for?


@Hannah Thank you very much! My website is online. https://halfrost.com/

I follow your recommendation:

  1. uninstall nvm
  2. reinstall node & npm
  3. reinstall Ghost-CLI
  4. run ghost update 4.0.1 --force

Then everything is OK~ I hope these steps can be useful.


That’s great news!

1 Like

After reinstalling nodejs and ghost, I found ghost in different folder than before:

whereis ghost: /usr/bin/ghost (used to be /usr/local/bin/ghost)

the systemd config has different path for ghost:
cat /etc/systemd/system/ghost_test.service

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

Then, i changed /usr/local/bin/ghost to /usr/bin/ghost and did:

sudo systemctl daemon-reload
ghost start

which finally worked. Hope it helps somebody!

1 Like

Can anyone solve this also: https://forum.ghost.org/t/eacces-permission-denied-open-var-www-ghost-ghost-cli/20988

In my case, I needed nvm for other applications so It would be a hassle to have to uninstall it. Instead I did the following:

which ghost

# /home/<your_user>/.nvm/versions/node/v12.17.0/bin/ghost

Then I modified the ghost.service with the ghost binary path in nvm:

sudo vim /etc/systemd/system/ghost_your-blog-com

Description=Ghost systemd service for blog: your-blog-com

#ExecStart=/usr/bin/node /usr/bin/ghost run
ExecStart=/usr/bin/node /home/<your_user>/.nvm/versions/node/v12.17.0/bin/ghost run


Afterward, run

sudo systemctl daemon-reload
ghost start

Thanks @elergy for the hints :raised_hands:


Thanks so much, this is the right solution for nvm users