Ghost failing to start after upgrades from v1 to v3.12

Hi, firstly I hope everyone is well and safe at this difficult time. Per the title, I’ve upgraded my Ghost installation from v1 to v3. (details below) and Ghost is failing to start.

Symptoms:

  • ghost start or ghost restart hangs
  • ghost run shows a connection refused on bootstrap port 8000
  • if I go to config.json and remove the bootstrap-socket stanza, then run ghost run, ghost starts OK (but obviously that’s not ideal)
  • if I then run ghost start or ghost restart, the bootstrap stanza is reinserted and ghost fails to start
  • netstat indicates nothing else running on 8000; and if I change the bootstrap port to another number I still get the same issue

Version info:

  • OS = Ubuntu 18.04.4 (Digital Ocean droplet)
  • Nginx = 1.14.0
  • Node = 10.19.0
  • Ghost-CLI = 1.13.1
  • Ghost = 3.12.1

Here’s the config file (bootstrap-socket stanza included). The port 2368 correctly maps to the nginx config and, per the above, ghost does indeed start if it doesn’t have to connect to the bootstrap port:

{
  "url": "http://www.mydomain.net",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "ghost",
      "password": "longstring",
      "database": "ghost"
    }
  },
  "mail": {
    "transport": "Direct",
    "options": {
      "service": "Mailgun",
      "auth": {
        "user": "postmaster@sandboxlongstring.mailgun.org",
        "pass": "longstring"
      }
    }
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  },
  "bootstrap-socket": {
    "port": 8000,
    "host": "localhost"
  }
}

Would very much appreciate any ideas, thanks.

Also, noticed this in repeatedly syslog, if relevant. The error appears if I run ghost start but not if I use ghost run.

Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]: /var/www/ghost/versions/3.12.1/node_modules/fs-extra/lib/index.js:5
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:   ...require('./fs'),
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:   ^^^
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]: SyntaxError: Unexpected token ...
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Object.exports.runInThisContext (vm.js:76:16)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Module._compile (module.js:542:28)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Object.Module._extensions..js (module.js:579:10)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Module.load (module.js:487:32)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at tryModuleLoad (module.js:446:12)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Function.Module._load (module.js:438:3)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Module.require (module.js:497:17)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at require (internal/module.js:20:19)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Object.<anonymous> (/var/www/ghost/versions/3.12.1/core/server/config/utils.js:2:10)
Mar 28 22:15:40 ghost-1gb-lon1-01 node[16149]:     at Module._compile (module.js:570:32)
Mar 28 22:15:40 ghost-1gb-lon1-01 systemd[1]: ghost_www-conqueredworlds-net.service: Service hold-off time over, scheduling restart.
Mar 28 22:15:40 ghost-1gb-lon1-01 systemd[1]: ghost_www-conqueredworlds-net.service: Scheduled restart job, restart counter is at 3.

Does ghost doctor run clean?

Yes

    gam@ghost-1gb-lon1-01:/var/www/ghost$ ghost doctor
    ✔ Checking system Node.js version
    ✔ Checking logged in user
    ✔ Ensuring user is not logged in as ghost user
    ✔ Checking if logged in user is directory owner
    ✔ Checking current folder permissions
    ✔ Checking operating system compatibility
    ✔ Checking for a MySQL installation
    + sudo systemctl is-active ghost_www-conqueredworlds-net
    ? Sudo Password [hidden]
    + sudo systemctl reset-failed ghost_www-conqueredworlds-net
    ✔ Validating config
    ✔ Checking folder permissions
    ✔ Checking file permissions
    ✔ Checking content folder ownership
    ✔ Checking memory availability
    ✔ Checking binary dependencies
    gam@ghost-1gb-lon1-01:/var/www/ghost

Are you running nvm on your server? This might be why it’s unable to run Ghost, as Ghost may be using an older, or newer, version of Node. We recommend uninstalling nvm for production sites https://ghost.org/faq/using-nvm/ and installing the right version globally https://ghost.org/docs/install/ubuntu/#install-nodejs

Hope this helps!

David
Thanks for your help, this basically fixed it.

  • Removed local copies of node and nvm per the instructions.
  • Discovered rogue copy of ghost-cli in /usr/local/bin; removed that
  • For some reason my ghost user doesn’t pick up /usr/bin, symlinked ghost and node to /usr/local/bin

System now starts fine.

Many thanks
Mark

1 Like

Also removed a bunch of other stuff from /usr/local/bin but for some reason it still insists on the node and ghost executables being there to start.