After update to version 3 Ghost won't start

Hi,
i updated to the latest version of ghost-cli and ghost but it can’t start:

ghost_user@ghostname:/var/www/ghostname.com/html/blog$ ghost start
++ sudo systemctl is-active ghost_ghostname-com
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_ghostname-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
+ sudo systemctl start ghost_ghostname-com
+ sudo systemctl stop ghost_ghostname-com
✖ Starting Ghost
A GhostError occurred.

Message: Could not communicate with Ghost
Suggestion: journalctl -u ghost_ghostname-com -n 50

Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v12.13.0
    Ghost-CLI Version: 1.12.0
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/ghost_user/.ghost/logs/ghost-cli-debug-2019-10-23T09_41_50_082Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/api/ghost-cli/ for troubleshooting.
ghost_user@ghostname:/var/www/ghostname.com/html/blog$ ^C
ghost_user@ghostname:/var/www/ghostname.com/html/blog$ journalctl -u ghost_ghostname-com -n 50
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
-- Logs begin at Mon 2019-09-09 16:40:50 CEST, end at Wed 2019-10-23 11:30:48 CEST. --
-- No entries --
ghost_user@ghostname:/var/www/ghostname.com/html/blog$ sudo journalctl -u ghost_ghostname-com -n 50
-- Logs begin at Mon 2019-08-26 07:58:40 CEST, end at Wed 2019-10-23 11:49:26 CEST. --
Oct 23 11:37:08 ghostname.com systemd[1]: Stopped Ghost systemd service for blog: ghostname-com.
Oct 23 11:37:08 ghostname.com systemd[1]: Started Ghost systemd service for blog: ghostname-com.
Oct 23 11:37:09 ghostname.com node[2421]: Knex: run
Oct 23 11:37:09 ghostname.com node[2421]: $ npm install sqlite3 --save
Oct 23 11:37:09 ghostname.com node[2421]: Cannot find module '/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/sqlite3/lib/binding/node-v57-linux-x64/node_sqlite3.node'
Oct 23 11:37:09 ghostname.com node[2421]: Error: Cannot find module '/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/sqlite3/lib/binding/node-v57-linux-x64/node_sqlite3.node'
Oct 23 11:37:09 ghostname.com node[2421]:     at Function.Module._resolveFilename (module.js:548:15)
Oct 23 11:37:09 ghostname.com node[2421]:     at Function.Module._load (module.js:475:25)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module.require (module.js:597:17)
Oct 23 11:37:09 ghostname.com node[2421]:     at require (internal/module.js:11:18)
Oct 23 11:37:09 ghostname.com node[2421]:     at Object.<anonymous> (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/sqlite3/lib/sqlite3.js:4:15)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module._compile (module.js:653:30)
Oct 23 11:37:09 ghostname.com node[2421]:     at Object.Module._extensions..js (module.js:664:10)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module.load (module.js:566:32)
Oct 23 11:37:09 ghostname.com node[2421]:     at tryModuleLoad (module.js:506:12)
Oct 23 11:37:09 ghostname.com node[2421]:     at Function.Module._load (module.js:498:3)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module.require (module.js:597:17)
Oct 23 11:37:09 ghostname.com node[2421]:     at require (internal/module.js:11:18)
Oct 23 11:37:09 ghostname.com node[2421]:     at Client_SQLite3._driver (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/dialects/sqlite3/index.js:36:12)
Oct 23 11:37:09 ghostname.com node[2421]:     at Client_SQLite3.initializeDriver (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/client.js:221:26)
Oct 23 11:37:09 ghostname.com node[2421]:     at Client_SQLite3.Client (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/client.js:59:10)
Oct 23 11:37:09 ghostname.com node[2421]:     at new Client_SQLite3 (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/dialects/sqlite3/index.js:18:10)
Oct 23 11:37:09 ghostname.com node[2421]: /var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/client.js:225
Oct 23 11:37:09 ghostname.com node[2421]:       throw new Error(`${message}\n${e.message}`);
Oct 23 11:37:09 ghostname.com node[2421]:       ^
Oct 23 11:37:09 ghostname.com node[2421]: Error: Knex: run
Oct 23 11:37:09 ghostname.com node[2421]: $ npm install sqlite3 --save
Oct 23 11:37:09 ghostname.com node[2421]: Cannot find module '/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/sqlite3/lib/binding/node-v57-linux-x64/node_sqlite3.node'
Oct 23 11:37:09 ghostname.com node[2421]:     at Client_SQLite3.initializeDriver (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/client.js:225:13)
Oct 23 11:37:09 ghostname.com node[2421]:     at Client_SQLite3.Client (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/client.js:59:10)
Oct 23 11:37:09 ghostname.com node[2421]:     at new Client_SQLite3 (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/dialects/sqlite3/index.js:18:10)
Oct 23 11:37:09 ghostname.com node[2421]:     at Knex (/var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/knex/lib/knex.js:52:28)
Oct 23 11:37:09 ghostname.com node[2421]:     at Object.<anonymous> (/var/www/ghostname.com/html/blog/versions/3.0.0/core/server/data/db/connection.js:33:20)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module._compile (module.js:653:30)
Oct 23 11:37:09 ghostname.com node[2421]:     at Object.Module._extensions..js (module.js:664:10)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module.load (module.js:566:32)
Oct 23 11:37:09 ghostname.com node[2421]:     at tryModuleLoad (module.js:506:12)
Oct 23 11:37:09 ghostname.com node[2421]:     at Function.Module._load (module.js:498:3)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module.require (module.js:597:17)
Oct 23 11:37:09 ghostname.com node[2421]:     at require (internal/module.js:11:18)
Oct 23 11:37:09 ghostname.com node[2421]:     at isDatabaseInitialisationRequired (/var/www/ghostname.com/html/blog/versions/3.0.0/core/server/index.js:156:16)
Oct 23 11:37:09 ghostname.com node[2421]:     at makeGhost (/var/www/ghostname.com/html/blog/versions/3.0.0/core/index.js:13:12)
Oct 23 11:37:09 ghostname.com node[2421]:     at Object.<anonymous> (/var/www/ghostname.com/html/blog/versions/3.0.0/index.js:20:1)
Oct 23 11:37:09 ghostname.com node[2421]:     at Module._compile (module.js:653:30)
Oct 23 11:37:10 ghostname.com systemd[1]: ghost_ghostname-com.service: Service hold-off time over, scheduling restart.
Oct 23 11:37:10 ghostname.com systemd[1]: ghost_ghostname-com.service: Scheduled restart job, restart counter is at 10.
Oct 23 11:37:10 ghostname.com systemd[1]: Stopped Ghost systemd service for blog: ghostname-com.
Oct 23 11:37:10 ghostname.com systemd[1]: ghost_ghostname-com.service: Start request repeated too quickly.
Oct 23 11:37:10 ghostname.com systemd[1]: ghost_ghostname-com.service: Failed with result 'start-limit-hit'.
Oct 23 11:37:10 ghostname.com systemd[1]: Failed to start Ghost systemd service for blog: ghostname-com.
ghost_user@ghostname:/var/www/ghostname.com/html/blog$

Installed with sqlite3 fro DB
Any advice? It seems somthign regarding sqlite database.

Thanks
Mik

Did you change node versions at all?

Try running ghost upgrade --force to reinstall the dependencies.

I upgraded because can’t upgrade ghost cli I changed node version to latest 12.13.0 before upgrade.
I tried the command you suggested, same result as before

If you switch node versions, then Ghost’s dependencies have to be reinstalled, as binary dependencies like sqlite3 are compiled for the node version. Therefore, it’s always recommended to upgrade Node, and then upgrade Ghost CLI and Ghost.

If ghost update --force doesn’t sort out your dependencies, this suggests that you may have mismatched node versions between your users and system somehow.

Can you show the output from ghost update --force?

If trying that again doesn’t fix it, then you’d need to try to resolve the dependencies manually by cding into versions/3.0.0 and trying npm rebuild.

Hi,

the result of npm update --force

ghost_user@ghostname:/var/www/ghostname.com/html/blog$ ghost update --force
+ sudo systemctl is-active ghostname-com
? Sudo Password [hidden]
✔ 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
✔ Downloading and updating Ghost to v3.0.0
✔ Linking latest Ghost and recording versions
ℹ Removing old Ghost versions [skipped]

seems all fine
then into the versions/3.0.0 I get an errror doing sudo npm rebuild

ghost_user@ghostname:/var/www/ghostname.com/html/blog/versions/3.0.0$ sudo npm rebuild

> core-js@2.6.9 postinstall /var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> jsonpath@1.0.2 postinstall /var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js


> sharp@0.23.1 install /var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using existing vendored libvips v8.8.1
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 47, in <module>
    import gyp
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 10, in <module>
    import gyp.input
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 7, in <module>
    import ast
ImportError: No module named ast
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-23-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/ghostname.com/html/blog/versions/3.0.0/node_modules/sharp
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.23.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Any idea?

The problem here is with installing sharp - I’ve raised that here: Sharp as a dependency of Ghost, install fails on upgrade · Issue #1941 · lovell/sharp · GitHub

I think sharp may be preventing sqlite3 from being installed - but it shouldn’t :thinking:

In the meantime, your site should start if you ca get sqlite3 installed, as sharp is an optional dependency

  • Run npm rebuild without sudo.
  • Run npm install --unsafe-perm

Try npm install sqlite3 separately.

Sharp is used for image processing. So without it, you won’t have image resizing but the site should start.