Hello.
Originally trying to update from version 1.20.0 I had on an old machine, I have followed the Ghost Docs guide:
- backup everything
- ghost update
- ghost start
I’m now on 3.0.3 but ghost start always fails with a migration error on 1-og-twitter-post.js.
Message: Cannot read property ‘type’ of undefined
The strange part is that this error cannot happen when I look at the code of this .js file, option.type is always defined (if my JavaScript knowledge is not too rusty…)
I hope I’m not forgetting to copy-paste relevant info (ignore the folder name ghost-1.2.0):
~/ghost-1.2.0/ $ npm --version
6.13.0
.
~/ghost-1.2.0/ $ ghost --version
Ghost-CLI version: 1.13.1
Ghost version: 3.0.3 (at ~/ghost-1.2.0)
.
~/ghost-1.2.0/ $ ghost doctor
Process manager 'systemd' will not run on this system, defaulting to 'local'
✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
System checks failed with message: 'Linux version is not Ubuntu 16 or 18'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? Yes
System stack check skipped
ℹ Checking operating system compatibility [skipped]
✔ Checking for a MySQL installation
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking memory availability
✔ Checking binary dependencies
.
~/ghost-1.2.0/ $ ghost start
Process manager 'systemd' will not run on this system, defaulting to 'local'
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking memory availability
✔ Checking binary dependencies
✖ Starting Ghost: japan-lloyd-ovh
A GhostError occurred.
Message: Cannot read property 'type' of undefined
Help: Error occurred while executing the following migration: 1-og-twitter-post.js
Debug Information:
OS: Gentoo, vunknown
Node Version: v8.16.2
Ghost Version: 3.0.3
Ghost-CLI Version: 1.13.1
Environment: production
Command: 'ghost start'
Additional log info available in: /home/lloyd/.ghost/logs/ghost-cli-debug-2019-11-13T23_40_05_029Z.log
Try running ghost doctor to check your system for known issues.
You can always refer to https://ghost.org/docs/api/ghost-cli/ for troubleshooting.
~/ghost-1.2.0/ $ cat /home/lloyd/.ghost/logs/ghost-cli-debug-2019-11-13T23_40_05_029Z.log
Debug Information:
OS: Gentoo, vunknown
Node Version: v8.16.2
Ghost Version: 3.0.3
Ghost-CLI Version: 1.13.1
Environment: production
Command: 'ghost start'
Message: Cannot read property 'type' of undefined
Help: Error occurred while executing the following migration: 1-og-twitter-post.js
Stack: Error: Cannot read property 'type' of undefined
at ChildProcess.cp.on (/usr/lib64/node_modules/ghost-cli/lib/utils/local-process.js:63:35)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at emit (internal/child_process.js:762:12)
at _combinedTickCallback (internal/process/next_tick.js:142:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
.
~/ghost-1.2.0 $ cat ./versions/3.0.3/core/server/data/migrations/versions/1.5/1-og-twitter-post.js
const Promise = require('bluebird'),
common = require('../../../../lib/common'),
commands = require('../../../schema').commands,
table = 'posts',
columns = ['og_image', 'og_title', 'og_description', 'twitter_image', 'twitter_title', 'twitter_description'],
_private = {};
_private.handle = function handle(options) {
let type = options.type,
isAdding = type === 'Adding',
operation = isAdding ? commands.addColumn : commands.dropColumn;
return function (options) {
let connection = options.connection;
return connection.schema.hasTable(table)
.then(function (exists) {
if (!exists) {
return Promise.reject(new Error('Table does not exist!'));
}
return Promise.each(columns, function (column) {
return connection.schema.hasColumn(table, column)
.then(function (exists) {
if (exists && isAdding || !exists && !isAdding) {
common.logging.warn(`${type} column ${table}.${column}`);
return Promise.resolve();
}
common.logging.info(`${type} column ${table}.${column}`);
return operation(table, column, connection);
});
});
});
};
};
module.exports.up = _private.handle({type: 'Adding'});
module.exports.down = _private.handle({type: 'Dropping'});