Upgrading ghost to 3.X from 2.x

Upgrading Ghost from v2.x to v3.x and fixing compatibility of ghost-cli with nodejs versions.

I was upgrading my blog(ghost) from v2.x to v3.x and encountered a strange error with the ghost-cli command.

TL;DR Check compatibility of ghost-cli with nodejs version

As usual, I fired up the terminal and ran the command:

ghost update

and got the strange error.

ghost update

    static async _run(commandName, argv = {}, extensions) {

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/ghost-cli/lib/bootstrap.js:6:17)

That seemed an odd error and was giving nothing for me to debug. I checked the Ghost Github issue tracker for any clues, but to my dismay it did not give me any clues either.

But after looking through the documentation, I noticed the the supported nodejs versions document here

And to my surprise, I was running nodejs v6, which is not supported by ghost anymore.

So that was the clue that I needed, and I went ahead with upgrading my nodejs version to 10.x and 🎉 it fixed the issue with the ghost-cli.

Commands to upgrade nodejs version(taken from the faq page above)

To upgrade the steps are:

# update your source list with the version of Node.js you want to upgrade to.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash

# upgrade Node/ks
sudo apt-get install -y nodejs

# force Ghost to update even if there are no new versions of Ghost,
# to trigger a re-install of dependencies.
ghost update --force

That was smooth.