Skip to content

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

@wiseflat

Description

@wiseflat

Hi Olivier,

You updated your main project an I found this mistake :

$ node xpl-sysinfo 
/opt/xpl-sysinfo/node_modules/xpl-api/lib/xpl-api.js:11
class XplAPI extends Events.EventEmitter {
^^^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/opt/xpl-sysinfo/lib/xpl-sysinfo.js:1:73)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)

I found on internet this solution :

node --use_strict xpl-sysinfo 

What should I do in my code to solve this issue ?

I can manage to solve this by adding "--user_strict" inside my run level service (systemd, sysvinit or pm2) but it's a bit dirty isn't it ? :-) Should I learn more about es6 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions