Upgrading Ghost from 0.8.0 to 0.9.0 properly

Ghost 0.9.0 is out, so we might want to upgrade our Ghost instance to the latest stable version.

Following the official Ghost documentation leads to having a broken Ghost instance:

$ npm start --production

> ghost@0.9.0 start /var/www/samoylov
> node index


ERROR: Cannot find module 'lodash/object/assign' 

 Error: Cannot find module 'lodash/object/assign'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/var/www/samoylov/node_modules/knex/lib/raw.js:8:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/var/www/samoylov/node_modules/knex/lib/index.js:3:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/var/www/samoylov/node_modules/knex/knex.js:8:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32) 

Yes, your first idea is: "I will fix it with running $ npm install lodash --save". But it doesn't help.

$ npm install lodash --save
npm WARN unmet dependency /var/www/samoylov/node_modules/knex requires lodash@'^3.7.0' but will load  
npm WARN unmet dependency /var/www/samoylov/node_modules/lodash,  
npm WARN unmet dependency which is version 4.13.1  
lodash@4.13.1 node_modules/lodash  

This is what you should do really:

$ rm -rf node_modules/
$ npm install --production
$ npm start --production

> ghost@0.9.0 start /var/www/samoylov
> node index

Migrations: Creating database backup  
Ghost is running in production...  
Your blog is now available on https://samoylov.tech  
Ctrl+C to shut down  
Migrations: Database backup written to: /var/www/samoylov/content/data/michael-samoylov.ghost.2016-08-06.json  
Migrations: ###########  
Migrations: Updating database to 006  
Migrations: ###########

Migrations: Running fixture updates  
Skipping Migrations: Transforming dates to UTC: Your databases uses UTC datetimes, skip!  
Migrations: Finished!  

Press Ctrl-C to terminate it, and start Ghost as you run it usually.

In the next article I will explain how to run Ghost with Supervisor.

Michael Samoylov

Python, JavaScript and Swift Expert with 12+ years of experience.

Vilnius, Lithuania https://monmar.tech

Subscribe to Michael Samoylov

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!