Question

Ghost installation won't update - "Unexpected identifier" error

Posted December 22, 2019 542 views
UbuntuGhost

I am trying to update my Ghost installation through the console. I’ve signed in, changed directory to var/www/ghost, and updated the Ghost CLI to the most recent version (1.31.1 as of this writing). But then when I type ghost update I get this:

/usr/lib/node_modules/ghost-cli/lib/command.js:108
    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)

I get the same result if I also switch to the Ghost manager first.

Any help would be much appreciated.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @roberttalbert,

I can see that someone reported the exact same problem in the Ghost forum here:

https://forum.ghost.org/t/ghost-cli-shows-errors-after-latest-update-to-1-11-0/7678/4

People there are suggesting that in order to fix this error you need to update your Node.js version from 6.x to 10.x.

What I could suggest here is first taking a Snapshot of your Droplet, just to be on the safe side. That way if anything goes wrong, you could always revert back.

Once you have the Snapshot taken, you could try following the steps from the Ghost forum:

  • Add the NodeSource APT repository for Node 10:
  • curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash
  • Install Node.js
  • apt-get install -y nodejs
  • Afterwards test your Node.js version::
nodejs --version
v10.16.0
npm --version
6.9.0

Let me know how it goes!
Regards,
Bobby

Submit an Answer