Ghost: Cannot read property 'engine' of undefined

Chai Jia Xun
a read

This is part of my mini Ghost series, where I document the problems I ran into during the migration and how I solved them. You can find the other posts at the bottom.


While I was messing around with my ghost upgrade, I encountered a strange error and I couldn't seem to find a solution for it online.

Message: Cannot read property 'engine' of undefined

In case you are just looking for the solution, here it is: The theme is probably missing and ghost can’t load your theme. If you want to know how I got myself into this situation, you can stick around for a bit more.


This problem came about when I was moving my ghost blog from my production development environment to the development environment to develop my theme. In order to have my posts locally, I simply copied the database file from the server to my local machine. (I use SQLite, that’s why the database is a file). Since my local theme folder name was different from the one on the server, ghost crashed when trying to start. The strange thing is that ghost doctor runs fine. So I presume they never thought people would change or rename their theme folder.

ghost doctor gave me no errors

Another solution

Another method is to edit the database directly. In the ghost settings table, there is a field called theme. Set that field to casper, which is the default ghost theme and you should be able to start ghost again.

I hope this helps someone.


Appendix

I have added the full output below in case anyone needs it for debugging purposes.

jiaxun@jjjx-personal % ghost start 
+ sudo systemctl is-active ghost_chaijiaxun-com
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_chaijiaxun-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
+ sudo systemctl start ghost_chaijiaxun-com
+ sudo systemctl stop ghost_chaijiaxun-com
✖ Starting Ghost
A GhostError occurred.

Message: Cannot read property 'engine' of undefined
Suggestion: journalctl -u ghost_chaijiaxun-com -n 50

Debug Information:
    OS: Ubuntu, v16.04
    Node Version: v8.15.0
    Ghost-CLI Version: 1.9.9
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/jiaxun/.ghost/logs/ghost-cli-debug-2019-01-16T07_10_35_928Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://docs.ghost.org/api/ghost-cli/ for troubleshooting.

Ghost Mini Series

Check the next post: Tango Master: The Best Japanese Flashcard App There Isn't »

Share on:
Chai Jia Xun
Chai Jia Xun

Jia Xun speaks of himself in the third person when writing his bio. He thinks he's being cute but we all know that's just cliche. Being meta is so passe. Why do people still do it?