Ghost update 2->3 fails with syntax error

Upgrading from Ghost 2.18 to Latest fails with syntax error.

  • Version 2.18.3
  • Environment Debian 8.1
  • Database mysql 5.5
  • Mail Direct
  • node -v
    • v8.15.1
  • npm -v
    • 6.4.1

Following the suggestion, I first upgraded ghost-cli to latest:

sudo npm install -g ghost-cli@latest

Then I tried sudo -u ghostuser ghost update (also as root) and keep getting this error:

sudo ghost update
/usr/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
      } catch {
              ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

I am in the process of moving the ghost site to an entirely new server, but I thought it might be easy to update the site and then install the updated database and files on the new server. If there are better options, please let me know. For example, can I import the backup file exported by Ghost2.18 into a new Ghost3.x installation? If so, do I need to do anything special to the files, or can I just untar them in the new location?

Node v8 is EOL and no longer supported.

So you have 2 options:

  1. Upgrade node, then make sure you upgrade Ghost’s dependencies to work with the new Node.js version using ghost update [current version] --force and then upgrade Ghost with ghost update
  2. You can export from 2.x and import onto your new server on 3.x - this is supported in so far as the export-import flow works (e.g. some settings, integrations and members will need to be brought over in other ways).

Thanks, Hannah.
I exported and imported and it went pretty smoothly.