简体   繁体   中英

Ghost + Azure: Cannot read property '__cid' of undefined

New to ghost, and new to NodeJS, but couldn't resist trying to set Ghost up.

Goal: Get a new ghost instance up and running on Azure from source.

I followed Scott Hanselman's Post and Jeremiah Billmann's Post to attempt this.

I did the following:

  • Installed node, ruby, grunt-cli in my local environment
  • Performed a git clone of https://github.com/TryGhost/ghost.git into a folder in my downloads folder
  • Copied all files (except the .git folder) into my repository's root
  • Opened a command line in my repo's root
  • Ran npm install
  • Ran grunt init
  • Ran grunt prod
  • Created a server.js file in the root directory that contained var GhostServer = require('./index');
    • (i understand this is required for Azure)
  • Renamed config.example.js to config.js and edited its properties
    • NOTE: Did not touch anything in database (sqlite3) section
  • Edited the .gitignore to stop ignoring assets, config.js, and /core/built
  • Committed to Bitbucket
  • Azure picked up on it and deployed
  • I ran it, and got a 500-style error message
  • I edited the iisnode.yml file to have it output full errors

The full error I see is:

TypeError: Cannot read property '__cid' of undefined
    at Runner_SQLite3.<anonymous> 

Screenshot of the full error is below: 在此处输入图片说明

Any idea where I went wrong on this? The nature of the error message makes me suspect it's not me, but given that I'm new to this I could be completely wrong.

I've had a very similar problem with a fresh upgrade on a standard linux box. It seems like sqlite3 chokes on a non-existing path for its database.

Try that:

  1. Make sure that the /content/data directory exists (or whatever path you have set in your config file for the ghost-dev.db file). If not, create it.

    Normally, this should do the trick. If not, then maybe you need to force migrations via step 2 below.

  2. Try running :

FORCE_MIGRATION=true npm start

Ghost (0.5.3) includes, in config.js, the following path by default:

database: {
        client: 'sqlite3',
        connection: {
            filename: path.join(__dirname, '/content/data/ghost-dev.db')
        },
        debug: false
    },

Run the following series of commands, from the root directory of Ghost, to create the file path and file sqlite3 requires:

cd content
mkdir data
cd data
touch ghost-dev.db
../../
npm start

FYI: this can happen if the following line is included in your .gitignore file

/content/data/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM