question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when running `$ ghost restart` from a subdirectory

See original GitHub issue

Summary

If I run $ ghost start or $ ghost restart in a subdirectory of my Ghost folder it will throw a similar error as found in #442.

Steps to Reproduce

  1. Create a ghost project
  2. Make a new theme in the ghost project
  3. cd to this theme nested somewhere in the ghost project
  4. run $ ghost start

Any other info e.g. Why do you consider this to be a bug? What did you expect to happen instead?

I believe Ghost should recognize that the Ghost directory is somewhere further up and follow it.

Log file

Debug Information:
    OS: Mac OS X, v10.15.5
    Node Version: v12.16.3
    Ghost Version: 3.25.0
    Ghost-CLI Version: 1.14.1
    Environment: development
    Command: 'ghost restart'
Message: 
/USER/ghost/versions/3.25.0/node_modules/knex/lib/client.js:236
      throw new Error(`${message}\n${e.message}`);
      ^

Error: Knex: run
$ npm install sqlite3 --save
Cannot find module '/USER/ghost/versions/3.25.0/node_modules/sqlite3/lib/binding/node-v72-darwin-x64/node_sqlite3.node'
Require stack:
- /USER/ghost/versions/3.25.0/node_modules/sqlite3/lib/sqlite3-binding.js
- /USER/ghost/versions/3.25.0/node_modules/sqlite3/lib/sqlite3.js
- /USER/ghost/versions/3.25.0/node_modules/knex/lib/dialects/sqlite3/index.js
- /USER/ghost/versions/3.25.0/node_modules/knex/lib/knex.js
- /USER/ghost/versions/3.25.0/node_modules/knex/lib/index.js
- /USER/ghost/versions/3.25.0/node_modules/knex/knex.js
- /USER/ghost/versions/3.25.0/core/server/data/db/connection.js
- /USER/ghost/versions/3.25.0/core/server/index.js
- /USER/ghost/versions/3.25.0/core/index.js
- /USER/ghost/versions/3.25.0/index.js
    at Client_SQLite3.initializeDriver (/USER/ghost/versions/3.25.0/node_modules/knex/lib/client.js:236:13)
    at Client_SQLite3.Client (/USER/ghost/versions/3.25.0/node_modules/knex/lib/client.js:70:10)
    at new Client_SQLite3 (/USER/ghost/versions/3.25.0/node_modules/knex/lib/dialects/sqlite3/index.js:18:10)
    at Knex (/USER/ghost/versions/3.25.0/node_modules/knex/lib/knex.js:53:28)
    at Object.<anonymous> (/USER/ghost/versions/3.25.0/core/server/data/db/connection.js:34: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 (/USER/ghost/versions/3.25.0/core/server/index.js:163:16)
    at makeGhost (/USER/ghost/versions/3.25.0/core/index.js:13:12)
    at Object.<anonymous> (/USER/ghost/versions/3.25.0/index.js:27: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: 
/USER/ghost/versions/3.25.0/node_modules/knex/lib/client.js:236
      throw new Error(`${message}\n${e.message}`);
      ^

Error: Knex: run
$ npm install sqlite3 --save
Cannot find module '/USER/ghost/versions/3.25.0/node_modules/sqlite3/lib/binding/node-v72-darwin-x64/node_sqlite3.node'
Require stack:
- /USER/ghost/versions/3.25.0/node_modules/sqlite3/lib/sqlite3-binding.js
- /USER/ghost/versions/3.25.0/node_modules/sqlite3/lib/sqlite3.js
- /USER/ghost/versions/3.25.0/node_modules/knex/lib/dialects/sqlite3/index.js
- /USER/ghost/versions/3.25.0/node_modules/knex/lib/knex.js
- /USER/ghost/versions/3.25.0/node_modules/knex/lib/index.js
- /USER/ghost/versions/3.25.0/node_modules/knex/knex.js
- /USER/ghost/versions/3.25.0/core/server/data/db/connection.js
- /USER/ghost/versions/3.25.0/core/server/index.js
- /USER/ghost/versions/3.25.0/core/index.js
- /USER/ghost/versions/3.25.0/index.js
    at Client_SQLite3.initializeDriver (/USER/ghost/versions/3.25.0/node_modules/knex/lib/client.js:236:13)
    at Client_SQLite3.Client (/USER/ghost/versions/3.25.0/node_modules/knex/lib/client.js:70:10)
    at new Client_SQLite3 (/USER/ghost/versions/3.25.0/node_modules/knex/lib/dialects/sqlite3/index.js:18:10)
    at Knex (/USER/ghost/versions/3.25.0/node_modules/knex/lib/knex.js:53:28)
    at Object.<anonymous> (/USER/ghost/versions/3.25.0/core/server/data/db/connection.js:34: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 (/USER/ghost/versions/3.25.0/core/server/index.js:163:16)
    at makeGhost (/USER/ghost/versions/3.25.0/core/index.js:13:12)
    at Object.<anonymous> (/USER/ghost/versions/3.25.0/index.js:27: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> (/Users/jachedaya/.nvm/versions/node/v12.16.3/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)

Technical details

Seen in log.

Debug Information:
    OS: Mac OS X, v10.15.5
    Node Version: v12.16.3
    Ghost Version: 3.25.0
    Ghost-CLI Version: 1.14.1
    Environment: development
    Command: 'ghost restart'

Bug submission checklist

Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.

  • Tried to find help in the forum & docs
  • Checked for existing issues
  • Attached log file
  • Provided technical details incl. operating system

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
acburdinecommented, Aug 17, 2020

Perhaps if Ghost cannot find the production config but can find the development config it should launch with $ ghost start local by default?

It should do that automatically already, but there might be some sort of issue with that auto-detection not working when ghost restart is run in a subdirectory 🤔 I’ll do some testing myself and see what I can find.

0reactions
jackHedayacommented, May 4, 2021

Not sure what the status of this bug is but haven’t worked with Ghost in about a year so I’m going to be closing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mv empty subfolder causes deadlock #671 - microsoft/WSL
Bash crashes when trying to move an empty subdirectory - must restart computer (AFAIK) to recover e.g. root@MACHINE:/mnt/c/bash4/p3/process_content# mv ...
Read more >
Ghost crash on image restore | Ghost Solution Suite
I've created an image of server running VMware ESX 4.1 using standalone Ghost ... operation on that image, Ghost crashes in few seconds...
Read more >
Solving Ghost-CLI crashes on Ghost Start or Restart
I run Ghost on an Ubuntu server on DigitalOcean, which means I manually update ghost, ghost-cli and other parts that make it work....
Read more >
Long file paths crash File Explorer when accessing files on ...
The issue here is that File explorer crashes and restarts whenever browsing to a long path with a file that has a long...
Read more >
Single Page Doc - PM2
Restarting PM2 with the processes you manage on server boot/reboot is critical. To solve this, just run this command to generate an active...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found