maxwellhadley / node-red-contrib-rfxcom

node-RED nodes to access an RFXtrx433 transceiver
BSD 2-Clause "Simplified" License
22 stars 13 forks source link

Error when starting nodered: [rfxcom] SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode #25

Closed Anton04 closed 6 years ago

Anton04 commented 6 years ago

Here is what I get after upgrading nodered and runnig it under nodereds official docker container. I have also tried with node v4.6 and gets the same problem.

Welcome to Node-RED

1 Nov 12:07:06 - [info] Node-RED version: v0.15.2 1 Nov 12:07:06 - [info] Node.js version: v4.8.5 1 Nov 12:07:06 - [info] Linux 4.4.0-98-generic x64 LE 1 Nov 12:07:06 - [info] Loading palette nodes 1 Nov 12:07:08 - [warn] ------------------------------------------------------ 1 Nov 12:07:08 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node 1 Nov 12:07:08 - [warn] [rfxcom] SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode 1 Nov 12:07:08 - [warn] ------------------------------------------------------ 1 Nov 12:07:08 - [info] Settings file : /data/settings.js 1 Nov 12:07:08 - [info] User directory : /data 1 Nov 12:07:08 - [info] Flows file : /data/flows.json 1 Nov 12:07:08 - [info] Server now running at http://127.0.0.1:1880/ 1 Nov 12:07:09 - [info] Waiting for missing types to be registered: 1 Nov 12:07:09 - [info] - rfxtrx-port 1 Nov 12:07:09 - [info] - rfx-lights-in 1 Nov 12:07:09 - [info] - rfx-sensor 1 Nov 12:07:09 - [info] - rfx-detector-in 1 Nov 12:07:09 - [info] - rfx-lights-out

maxwellhadley commented 6 years ago

At first sight this looks like a problem with the node-rfxcom package that underlies node-red-contrib-rfxcom. That has been re-written recently to use more modern Javascript syntax, and it looks like node.js version 4.8.x needs to be told specifically to enable this syntax. The Javascript version compatibility website I was using as a reference didn't mention this! It should work fine with node.js version 6.x.x or 8.x.x, if that works for you (currently I test on 6.11.x). I will put the "use strict" pragmas back in next time node-rfxcom gets a bug-fix update (there is another minor issue on the to-do list)

maxwellhadley commented 6 years ago

Another thing that ought to work is to pass the --use_strict flag to node.js when starting Node-RED: see https://nodered.org/docs/getting-started/running for the details

maxwellhadley commented 6 years ago

I have updated node-rfxcom to "use strict" everywhere, which ought to fix this issue. Please update node-red-contrib-rfxcom to 2.1.1.