Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when running $ ghost restart from a subdirectory #1269

Closed
4 tasks done
jackHedaya opened this issue Aug 3, 2020 · 6 comments
Closed
4 tasks done

Crash when running $ ghost restart from a subdirectory #1269

jackHedaya opened this issue Aug 3, 2020 · 6 comments
Labels

Comments

@jackHedaya
Copy link

jackHedaya commented Aug 3, 2020

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
@acburdine
Copy link
Member

@jackHedaya the error you're showing in logs appears to be a different one than you're describing. As of Ghost-CLI 1.14.0 (this commit specifically), Ghost-CLI will correctly figure out your installation directory, even if you're currently in a subfolder.

The error you're running into appears to be related to a broken installation of sqlite3. You should be able to resolve the issue by running ghost update --force, which should re-install your current version of Ghost and, in theory, reinstall sqlite3 to resolve the issue.

@jackHedaya
Copy link
Author

I will try the ghost update --force but I find it strange that ghost restart only threw that error in a subdirectory.

@jackHedaya
Copy link
Author

@acburdine

Just ran $ ghost update --force and then attempted to run $ ghost restart again. I then did some investigating.

This error occured because $ ghost restart tried to create the Ghost instance but couldn't due to this being a local environment (and I did not have a production config file). I expected it to start using $ ghost start local but instead it started with $ ghost start. Perhaps if Ghost cannot find the production config but can find the development config it should launch with $ ghost start local by default?

@acburdine
Copy link
Member

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.

@jackHedaya jackHedaya changed the title Ghost CLI throw error if ran in a subdirectory of a Ghost directory Crash when running $ ghost restart from a subdirectory Aug 17, 2020
@github-actions
Copy link

github-actions bot commented May 3, 2021

Our bot has automatically marked this issue as stale because there has not been any activity here in some time. The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR. We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂

@github-actions github-actions bot added the Stale label May 3, 2021
@jackHedaya
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants