runtimeZero runtimeZero - 1 year ago 153
Node.js Question

Receiving strict mode warning while running node 4.4.7

I believe node v4.4.7 supported ES6. However node refuses to compile my program:

user1-$ node -v

user1-$ node index.js
let sql = 'SELECT * FROM group_events where id = ?';

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

I know that placing 'user strict' on top of the file will resolve this, However I don't wish to place 'use strict' on top.

Any other options ?

Answer Source

run node --use_strict index.js to force it using strict mode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download