0

I'm using nodejs, express.

My code was...

var option = { name: 'Tobi' };
app.render('email', { option });

and I deployed to production env. it threw error SyntaxError: Unexpected token }

and my lovely node server died... :scream:

anyway, I fixed it. like this...

var option = { name: 'Tobi' };
app.render('email', option);

Buuuuut,

in my local env, I couldn't catch that. I know it was my mistake.

How can I catch the syntax error in local environment?

I thought it can be done by jshint. but i couldn't find the appropriate option from jshint.

I need your help. THX

Margaux
  • 139
  • 2
  • 5

1 Answers1

2

The { option } syntax is new in ES6.

Presumably the problem is that your development environment is using a newer version of NodeJS than your production environment so that your production environment does not support the new syntax. (Support was added in version 4 of NodeJS).

Make sure that you match software versions between your production and development environments.

Community
  • 1
  • 1
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335