Ghost Error Occurred - Knex? Sqlite?

Not sure what has changed with my local setup, but all three of my Ghost local installs have stopped working and I’m really struggling to get them back up and running.

ghost doctor - No errors for all installs.

This is the error I get when trying to run ‘ghost start’

    OS: Mac OS X, v10.15.4
    Node Version: v12.16.3
    Ghost Version: 3.12.1
    Ghost-CLI Version: 1.14.0
    Environment: development
    Command: 'ghost start'
Message: 
/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/client.js:225
      throw new Error(`${message}\n${e.message}`);
      ^

Error: Knex: run
$ npm install sqlite3 --save
Cannot find module '/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/sqlite3/lib/binding/node-v72-darwin-x64/node_sqlite3.node'
Require stack:
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/sqlite3/lib/sqlite3.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/dialects/sqlite3/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/knex.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/knex.js
- /Users/simon/Work/_Discover_/versions/3.12.1/core/server/data/db/connection.js
- /Users/simon/Work/_Discover_/versions/3.12.1/core/server/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/core/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/index.js
    at Client_SQLite3.initializeDriver (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/client.js:225:13)
    at Client_SQLite3.Client (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/client.js:59:10)
    at new Client_SQLite3 (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/dialects/sqlite3/index.js:18:10)
    at Knex (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/knex.js:52:28)
    at Object.<anonymous> (/Users/simon/Work/_Discover_/versions/3.12.1/core/server/data/db/connection.js:33:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at isDatabaseInitialisationRequired (/Users/simon/Work/_Discover_/versions/3.12.1/core/server/index.js:164:16)
    at makeGhost (/Users/simon/Work/_Discover_/versions/3.12.1/core/index.js:13:12)
    at Object.<anonymous> (/Users/simon/Work/_Discover_/versions/3.12.1/index.js:23:1)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

Stack: Error: 
/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/client.js:225
      throw new Error(`${message}\n${e.message}`);
      ^

Error: Knex: run
$ npm install sqlite3 --save
Cannot find module '/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/sqlite3/lib/binding/node-v72-darwin-x64/node_sqlite3.node'
Require stack:
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/sqlite3/lib/sqlite3.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/dialects/sqlite3/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/knex.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/knex.js
- /Users/simon/Work/_Discover_/versions/3.12.1/core/server/data/db/connection.js
- /Users/simon/Work/_Discover_/versions/3.12.1/core/server/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/core/index.js
- /Users/simon/Work/_Discover_/versions/3.12.1/index.js
    at Client_SQLite3.initializeDriver (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/client.js:225:13)
    at Client_SQLite3.Client (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/client.js:59:10)
    at new Client_SQLite3 (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/dialects/sqlite3/index.js:18:10)
    at Knex (/Users/simon/Work/_Discover_/versions/3.12.1/node_modules/knex/lib/knex.js:52:28)
    at Object.<anonymous> (/Users/simon/Work/_Discover_/versions/3.12.1/core/server/data/db/connection.js:33:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at isDatabaseInitialisationRequired (/Users/simon/Work/_Discover_/versions/3.12.1/core/server/index.js:164:16)
    at makeGhost (/Users/simon/Work/_Discover_/versions/3.12.1/core/index.js:13:12)
    at Object.<anonymous> (/Users/simon/Work/_Discover_/versions/3.12.1/index.js:23:1)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/ghost-cli/lib/utils/local-process.js:65:35)
    at ChildProcess.emit (events.js:310:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)


Any advice for debugging would be greatly appreciated

I have installed a new local installation using the following code and it all works fine so not sure why all the old ones are busted?:

Hey @simonmc

Thanks for posting the debug info! It looks like Ghost is having trouble finding the sqlite library to interact with your database. Can you try running ghost buster to clear the module cache, and then ghost update 3.12.1 --force to reinstall this version of ghost?

1 Like

You are a legend @vikaspotluri123 ! Thanks.
The ghost update worked a treat on all installs.

1 Like

@simonmc did you upgrade your Node.js version? If you do that, you have to run the commands @vikaspotluri123 gave you afterwards.

Ghost uses binary modules compiled against the node version, so if you upgrade node they need to be reinstalled.

The CLI should detect if the node version changes and prompt you to fix it - here’s the error it will output:

image

That was exactly what I’d done. Thanks for the tip!

Thanks for your help!

Hey @simonmc if you have a moment could you share the exact details of how you have Node installed and how you updated Node?

Ghost-CLI should give you a specific error if the binary dependencies need reinstalling, as shown above so we’d love to create a full reproduction case to get this fixed.

Your help would make it possible for us to fix this right away.

Thanks!