TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
47.15k stars 10.26k forks source link

[alpha.15] "DB_NOT_INITIALISED" after update from alpha.14 #8102

Closed PaszaVonPomiot closed 7 years ago

PaszaVonPomiot commented 7 years ago

Issue Summary

Ghost alpha.14 was working properly. I ran 'ghost update' which was successful. After starting ghost I got "DB_NOT_INITIALISED" error.

Steps to Reproduce

  1. Install and configure ghost alpha.14 so that is works
  2. Update with 'ghost update'
  3. Run "ghost run"

Technical details:

Log


root@ghost:/var/www/ghost# ghost ls
┌───┬─────────────────────────┬──────┬─────────────┬─────────────────┬────────────────┐
│ # │ Url                     │ Port │ Environment │ Process Manager │ Location       │
├───┼─────────────────────────┼──────┼─────────────┼─────────────────┼────────────────┤
│ 1 │ http://192.168.1.75:80/ │ 80   │ production  │                 │ /var/www/ghost │
└───┴─────────────────────────┴──────┴─────────────┴─────────────────┴────────────────┘
root@ghost:/var/www/ghost# ghost update
 ✔ Checking for latest Ghost version
 ✔ Downloading and updating Ghost to v1.0.0-alpha.15
 ✔ Stopping Ghost
 ✔ Linking things
 ✔ Restarting Ghost
root@ghost:/var/www/ghost# ghost ls
┌───┬─────────────────────────┬──────┬─────────────┬─────────────────┬────────────────┐
│ # │ Url                     │ Port │ Environment │ Process Manager │ Location       │
├───┼─────────────────────────┼──────┼─────────────┼─────────────────┼────────────────┤
│ 1 │ http://192.168.1.75:80/ │ 80   │ production  │                 │ /var/www/ghost │
└───┴─────────────────────────┴──────┴─────────────┴─────────────────┴────────────────┘

root@ghost:/var/www/ghost# ghost stop
✔ Stopping Ghost
root@ghost:/var/www/ghost# ghost run

/usr/local/lib/node_modules/ghost-cli/lib/process/index.js:23
        throw error;
        ^
Please run knex-migrator init
root@ghost:/var/www/ghost# [2017-03-06 21:04:06] ERROR

NAME: DatabaseIsNotOkError
CODE: DB_NOT_INITIALISED
MESSAGE: Please run knex-migrator init

level:normal

If knex-migrator is not installed, please run "npm install -g knex-migrator"
Read more here: https://github.com/TryGhost/knex-migrator
DatabaseIsNotOkError: Please run knex-migrator init
    at DatabaseIsNotOkError.KnexMigrateError (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/lib/errors.js:7:26)
    at new DatabaseIsNotOkError (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/lib/errors.js:19:26)
    at /var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/lib/index.js:548:19
    at tryCatcher (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:691:18)
    at Promise._fulfill (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:636:18)
    at Promise._resolveCallback (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:431:57)
    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:522:17)
    at Promise._settlePromise (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:691:18)
    at Promise._fulfill (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:636:18)
    at PropertiesPromiseArray.PromiseArray._resolve (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise_array.js:125:19)
    at PropertiesPromiseArray._promiseFulfilled (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/props.js:78:14)
    at Promise._settlePromise (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:572:26)
    at Promise._settlePromise0 (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:691:18)
    at Async._drainQueue (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues (/var/www/ghost/versions/1.0.0-alpha.15/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
root@ghost:~# npm install -g knex-migrator
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
/usr/local/bin/knex-migrator -> /usr/local/lib/node_modules/knex-migrator/bin/knex-migrator
/usr/local/bin/knex-migrator-init -> /usr/local/lib/node_modules/knex-migrator/bin/knex-migrator-init
/usr/local/bin/knex-migrator-health -> /usr/local/lib/node_modules/knex-migrator/bin/knex-migrator-health
/usr/local/bin/knex-migrator-migrate -> /usr/local/lib/node_modules/knex-migrator/bin/knex-migrator-migrate
/usr/local/bin/knex-migrator-reset -> /usr/local/lib/node_modules/knex-migrator/bin/knex-migrator-reset

> sqlite3@3.1.8 install /usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v48-linux-ia32.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.8 and node@6.10.0 (node-v48 ABI) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and
gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad
gyp ERR! stack network settings.
gyp ERR! stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:193:21)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at Request.emit (events.js:188:7)
gyp ERR! stack     at Request.onRequestError (/usr/local/lib/node_modules/npm/node_modules/request/request.js:813:8)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at ClientRequest.emit (events.js:188:7)
gyp ERR! stack     at TLSSocket.socketErrorListener (_http_client.js:310:9)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at TLSSocket.emit (events.js:188:7)
gyp ERR! stack     at connectErrorNT (net.js:1022:8)
gyp ERR! System Linux 3.16.0-4-586
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/node-v48-linux-ia32/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/node-v48-linux-ia32"
gyp ERR! cwd /usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/node-v48-linux-ia32/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/node-v48-linux-ia32' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 3.16.0-4-586
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3
node-pre-gyp ERR! node -v v6.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/node-v48-linux-ia32/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/local/lib/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/node-v48-linux-ia32' (1)
/usr/local/lib
└── knex-migrator@2.0.9

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sqlite3@3.1.8 (node_modules/knex-migrator/node_modules/sqlite3):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sqlite3@3.1.8 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
kirrg001 commented 7 years ago

Hey @draconus Sorry to hear you are having trouble.

This is a known issue. We have changed the database migrations in alpha.15. The Ghost CLI does not reset the database and that's why people experience this error.

As the alpha release is for development purpose only, you could either call knex-migrator reset && knex-migrator init to start from scratch or you could delete the third row of the migrations table (3-insert-settings.js).

Thanks for testing the alpha, good luck and swing by our slack channel if you need any help 👍

PaszaVonPomiot commented 7 years ago

@kirrg001 I'm glad you have that under control. No worries - I'm testing the alpha just to provide you feedback. Keep up good work! :+1: