recallfx / node-red-contrib-eufy-security

Eufy security node for Node RED
MIT License
6 stars 6 forks source link

SyntaxError on nodejs v12 #5

Closed mcr-ksh closed 11 months ago

mcr-ksh commented 2 years ago

older node-red (v1.0.2) with nodejs v12.22.6:

11 Sep 14:13:44 - [info] Installed module: node-red-contrib-eufy-security 11 Sep 14:13:44 - [info] Added node types: 11 Sep 14:13:44 - [info] - node-red-contrib-eufy-security:eufy-config : SyntaxError: Unexpected token . 11 Sep 14:13:44 - [info] - node-red-contrib-eufy-security:eufy-security : SyntaxError: Unexpected token .

davemclaughlin commented 2 years ago

I got the same error during install.

SyntaxError: Unexpected token '.' (line:24)

recallfx commented 2 years ago

The issue is Optional Chaning Operator support starts at node v14. It is possible to fix that by replacing this.credentials?.username with this.credentials && this.credentials.username. But there might be other places that use modern JS features. Is there any reason not to upgrade node to latest LTS version?

mcr-ksh commented 2 years ago

ah thank you. that was it. I got it running, however with a different problem I will address in another issue. The reason not to update was that we had legacy code that could not be converted to v14 but with a few hours of work that was migrated.