问题描述:

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

网友答案:

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.

相关阅读:
Top