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

Throws TypeError when installing using --db=sqlite3 flag #349

Closed
1 of 2 tasks
JoshTumath opened this issue Jul 11, 2017 · 13 comments · Fixed by #351 or #358
Closed
1 of 2 tasks

Throws TypeError when installing using --db=sqlite3 flag #349

JoshTumath opened this issue Jul 11, 2017 · 13 comments · Fixed by #351 or #358
Assignees
Labels
Milestone

Comments

@JoshTumath
Copy link

JoshTumath commented Jul 11, 2017

This issue is a

  • Bug Report
  • Feature Request

Summary

After setting up my server ready to install Ghost 1.0, I received a TypeError when I reached the 'Running database migrations' step.

Steps to Reproduce

  1. Run ghost install --db=sqlite3 in a new directory
  2. Enter a HTTPS URL for your blog when prompted
  3. Answer the remaining prompts with default answers until the 'Running database migrations' step

Technical details:

    Node Version: v6.11.1
    Ghost-CLI Version: 1.0.0-rc.2
    Environment: production
    Command: 'ghost install --db=sqlite3'
An error occurred.
Message: 'Argument 0 must be a string'

Stack: TypeError: Argument 0 must be a string
    at TypeError (native)
    at /usr/lib/node_modules/ghost-cli/node_modules/knex/lib/dialects/sqlite3/index.js:99:16
    at Promise._execute (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/debuggability.js:300:9)
    at Promise._resolveFromExecutor (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:79:10)
    at Client_SQLite3.acquireRawConnection (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/dialects/sqlite3/index.js:98:12)
    at Object.create (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/client.js:239:16)
    at Pool._createResource (/usr/lib/node_modules/ghost-cli/node_modules/generic-pool/lib/generic-pool.js:354:17)
    at Pool.dispense [as _dispense] (/usr/lib/node_modules/ghost-cli/node_modules/generic-pool/lib/generic-pool.js:314:10)
    at Pool.acquire (/usr/lib/node_modules/ghost-cli/node_modules/generic-pool/lib/generic-pool.js:436:8)
    at /usr/lib/node_modules/ghost-cli/node_modules/knex/lib/client.js:289:19
    at Promise._execute (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/debuggability.js:300:9)
    at Promise._resolveFromExecutor (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:79:10)
    at Client_SQLite3.acquireConnection (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/client.js:280:12)
    at /usr/lib/node_modules/ghost-cli/node_modules/knex/lib/runner.js:208:30```
@yoonsikp
Copy link

You need --db='sqlite3'

@JoshTumath
Copy link
Author

JoshTumath commented Jul 11, 2017

Yes, that is what I did. :)

(However, if it needs to be wrapped in quotation marks, that seems like something that needs to be caught immediately rather than waiting until this step.)

@kirrg001 kirrg001 added the bug label Jul 12, 2017
@ErisDS
Copy link
Member

ErisDS commented Jul 12, 2017

We have had 2 people report this issue today (another in slack).

The problem is that if you set --db=sqlite3 you must also pass --dbpath=/path/to/db

I think there may be some thing missing in the docs, but all the places I found mention both, so it would be great to get some feedback on how this was missed.

Secondly, I think it makes sense to use the default sqlite3 path of /content/data/ghost.db if --db=sqlite3 is passed, and no --dbpath is provided.

@acburdine acburdine self-assigned this Jul 12, 2017
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 12, 2017
… specified

closes TryGhost#349
- add defaultValue function to dbpath argument
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 12, 2017
closes TryGhost#349
- add defaultValue function to dbpath argument
@regalstreak
Copy link

It was deleted from the docs or something. The line is missing today

@JoshTumath
Copy link
Author

JoshTumath commented Jul 12, 2017

Secondly, I think it makes sense to use the default sqlite3 path of /content/data/ghost.db if --db=sqlite3 is passed, and no --dbpath is provided.

I think that would be great; also if the CLI tool was able to create the ghost.db file for you if it doesn't exist in the place you've pointed at. I had to create the DB file outside of the directory that Ghost was to be set up, because you can only run ghost install if the directory is empty.

@acburdine
Copy link
Member

@JoshTumath Ghost-CLI is already able to do that - the PR linked to this issue fixes the problem with the default path 😄

@JoshTumath
Copy link
Author

@acburdine Awesome, thanks! However, when I do as you say and specify that path, I get the following error:

Debug Information:
    Node Version: v6.11.1
    Ghost-CLI Version: 1.0.0-rc.2
    Environment: production
    Command: 'ghost install --db sqlite3 --dbpath ./content/data/ghost.db'
An error occurred.
Message: 'SQLITE_CANTOPEN: unable to open database file'

Stack: Error: SQLITE_CANTOPEN: unable to open database file
    at Error (native)
Code: SQLITE_CANTOPEN

@acburdine
Copy link
Member

This is true, hadn't realized the implications of this particular permissions issue. A fix will be implemented for both problems in the next version

@kirrg001
Copy link
Contributor

I just double checked on https://docs.ghost.org/v1.0.0/docs/install#section-options.
The docs say that you have to use both parameters. As said, would be actually cool to detect that in the CLI 👍

@acburdine acburdine added this to the 1.0 FINAL milestone Jul 13, 2017
@JoshTumath
Copy link
Author

This is true, hadn't realized the implications of this particular permissions issue. A fix will be implemented for both problems in the next version

@acburdine What exactly is the cause of this performance issue? Do you know of a hotfix for this in the meantime? 😄

@acburdine
Copy link
Member

Not a performance issue - a permissions issue :) there's not a hotfix at the moment, but I'm working on a fix that will be released in the next version (early next week).

@JoshTumath
Copy link
Author

I don't know why I said performance. 😆 Awesome, thanks for responding.

acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 14, 2017
refs TryGhost#349
- add defaultValue function to dbpath argument
acburdine added a commit that referenced this issue Jul 14, 2017
refs #349
- add defaultValue function to dbpath argument
@acburdine
Copy link
Member

Oops didn't mean for that commit to close this issue

@acburdine acburdine reopened this Jul 14, 2017
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 14, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 14, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 14, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 15, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 15, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 15, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 15, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 15, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 15, 2017
closes TryGhost#349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
acburdine added a commit that referenced this issue Jul 15, 2017
closes #349
- move knex-migrator to run in a child process, which allows us to initialize a sqlite database during a production ubuntu install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment