Failing updating ghost from v3.8.0 to v3.13.3 "SyntaxError: Unexpected token {"

Hi there

I’ve tried to update ghost by ghost update, and found that need rollback.

*A GhostError occurred.*

Message: Could not communicate with Ghost
Suggestion: journalctl -u ghost_megabrain-com-ua -n 50

Debug Information:

  • OS: Ubuntu, v16.04.6 LTS*
  • Node Version: v12.16.2*
  • Ghost Version: 3.13.3*
  • Ghost-CLI Version: 1.13.1*
  • Environment: production*
  • Command: ‘ghost update’*

Additional log info available in: /home/site/.ghost/logs/ghost-cli-debug-2020-04-18T08_30_30_822Z.log

Try running ghost doctor to check your system for known issues.

Then I’ve run sudo journalctl -u ghost_megabrain-com-ua -n 50

And found an interesting thing.

the part
/var/www/megabrain_ghost/versions/3.13.3/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
** } catch {**
** ^**
** SyntaxError: Unexpected token {**

It’s very interesting.

It may be a bug.

Will be thankful for any comments/suggestions.

@timebro it’s likely because you’re using nvm with multiple versions of node installed and your Ghost instance is using a older version of node that is no longer supported. Please search the forum, there are others who have run into similar issues

1 Like

Same as this thread:

1 Like

Hi @Kevin and @Hannah
and thanks!

First I had different node versions

nodejs -v
v8.17.0
node -v
v12.16.2

Then, updating nodejs did the trick!

  # Set up node.js 12 (latest LTS version)
   curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
   # Since you already have node.js installed, you need to _upgrade_ it rather than install it
   sudo apt upgrade -y nodejs

Now it works!