pimatic / pimatic-homeduino

Pimatic plugin for using 433mhz devices and sensors with a connected Arduino with homeduino sketch
https://pimatic.org/
GNU General Public License v2.0
37 stars 29 forks source link

Error: Unexpected token ILLEGAL on plugin load #91

Closed betz0r closed 5 years ago

betz0r commented 5 years ago

I found a problem after setting up my pimatic on RPi3 with node v4.6.2. During start of pimatic the log displays this message when the plugin is loaded. Reinstall and different location on drive doesn't make the error go away, so i guess it is in the code?

On Install:

14:55:55.450 [pimatic] info: Installing: "pimatic-homeduino@0.9.13" from npm-registry. 14:56:03.096 [pimatic, ppm] info: WARN engine prompt-radio@1.2.1: wanted: {"node":">=5.0"} (current: {"node":"4.6.2","npm":"2.15.12"}) 14:56:04.242 [pimatic, ppm] info: WARN engine prompt-checkbox@2.2.0: wanted: {"node":">=5.0"} (current: {"node":"4.6.2","npm":"2.15.12"}) 14:56:05.986 [pimatic, ppm] info: WARN engine prompt-base@4.1.0: wanted: {"node":">=5.0"} (current: {"node":"4.6.2","npm":"2.15.12"}) 14:56:15.956 [pimatic, ppm] info: WARN engine clone-deep@4.0.1: wanted: {"node":">=6"} (current: {"node":"4.6.2","npm":"2.15.12"}) 14:56:15.965 [pimatic, ppm] info: WARN engine set-value@3.0.0: wanted: {"node":">=6.0"} (current: {"node":"4.6.2","npm":"2.15.12"}) 14:56:20.428 [pimatic, ppm] info: WARN engine shallow-clone@3.0.1: wanted: {"node":">=8"} (current: {"node":"4.6.2","npm":"2.15.12"}) 14:56:27.573 [pimatic, ppm] info: > serialport@6.2.2 install /home/pimatic/pimatic-app/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport 14:56:27.575 [pimatic, ppm] info: > prebuild-install || node-gyp rebuild 14:56:29.140 [pimatic, ppm] info: prebuild-install WARN install No prebuilt binaries found (target=4.6.2 runtime=node arch=arm platform=linux) 14:56:31.566 [pimatic, ppm] info: make: Entering directory '/home/pimatic/pimatic-app/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build' 14:56:31.571 [pimatic, ppm] info: CXX(target) Release/obj.target/serialport/src/serialport.o 14:56:33.339 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterOpen(uv_work_t)’: 14:56:33.341 [pimatic, ppm] info: ../src/serialport.cpp:95:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.343 [pimatic, ppm] info: data->callback.Call(2, argv); 14:56:33.345 [pimatic, ppm] info: ^ 14:56:33.376 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.382 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.386 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.389 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.391 [pimatic, ppm] info: ^~~~ 14:56:33.393 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterUpdate(uv_work_t)’: 14:56:33.394 [pimatic, ppm] info: ../src/serialport.cpp:150:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.396 [pimatic, ppm] info: data->callback.Call(1, argv); 14:56:33.403 [pimatic, ppm] info: ^ 14:56:33.406 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.417 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.421 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.423 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.427 [pimatic, ppm] info: ^~~~ 14:56:33.429 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterClose(uv_work_t)’: 14:56:33.431 [pimatic, ppm] info: ../src/serialport.cpp:188:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.433 [pimatic, ppm] info: data->callback.Call(1, argv); 14:56:33.436 [pimatic, ppm] info: ^ 14:56:33.438 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.440 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.442 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.444 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.445 [pimatic, ppm] info: ^~~~ 14:56:33.447 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterFlush(uv_work_t)’: 14:56:33.449 [pimatic, ppm] info: ../src/serialport.cpp:231:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.451 [pimatic, ppm] info: data->callback.Call(1, argv); 14:56:33.455 [pimatic, ppm] info: ^ 14:56:33.456 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.458 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.460 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.462 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.464 [pimatic, ppm] info: ^~~~ 14:56:33.469 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterSet(uv_work_t)’: 14:56:33.471 [pimatic, ppm] info: ../src/serialport.cpp:285:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.473 [pimatic, ppm] info: data->callback.Call(1, argv); 14:56:33.475 [pimatic, ppm] info: ^ 14:56:33.476 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.478 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.480 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.485 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.491 [pimatic, ppm] info: ^~~~ 14:56:33.612 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterGet(uv_work_t)’: 14:56:33.614 [pimatic, ppm] info: ../src/serialport.cpp:336:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.616 [pimatic, ppm] info: data->callback.Call(2, argv); 14:56:33.619 [pimatic, ppm] info: ^ 14:56:33.621 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.623 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.628 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.630 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.636 [pimatic, ppm] info: ^~~~ 14:56:33.639 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterGetBaudRate(uv_work_t)’: 14:56:33.642 [pimatic, ppm] info: ../src/serialport.cpp:383:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.643 [pimatic, ppm] info: data->callback.Call(2, argv); 14:56:33.645 [pimatic, ppm] info: ^ 14:56:33.647 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.648 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.650 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.652 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.654 [pimatic, ppm] info: ^~~~ 14:56:33.659 [pimatic, ppm] info: ../src/serialport.cpp: In function ‘void EIO_AfterDrain(uv_work_t)’: 14:56:33.660 [pimatic, ppm] info: ../src/serialport.cpp:424:30: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:33.662 [pimatic, ppm] info: data->callback.Call(1, argv); 14:56:33.664 [pimatic, ppm] info: ^ 14:56:33.667 [pimatic, ppm] info: In file included from ../src/./serialport.h:6:0, 14:56:33.668 [pimatic, ppm] info: from ../src/serialport.cpp:1: 14:56:33.670 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:33.672 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:33.674 [pimatic, ppm] info: ^~~~ 14:56:36.521 [pimatic, ppm] info: CXX(target) Release/obj.target/serialport/src/serialport_unix.o 14:56:38.907 [pimatic, ppm] info: CXX(target) Release/obj.target/serialport/src/poller.o 14:56:40.628 [pimatic, ppm] info: ../src/poller.cpp: In static member function ‘static void Poller::onData(uv_poll_t, int, int)’: 14:56:40.630 [pimatic, ppm] info: ../src/poller.cpp:69:29: warning: ‘v8::Local Nan::Callback::Call(int, v8::Local) const’ is deprecated [-Wdeprecated-declarations] 14:56:40.632 [pimatic, ppm] info: obj->callback.Call(2, argv); 14:56:40.634 [pimatic, ppm] info: ^ 14:56:40.635 [pimatic, ppm] info: In file included from ../src/poller.cpp:1:0: 14:56:40.637 [pimatic, ppm] info: ../node_modules/nan/nan.h:1674:3: note: declared here 14:56:40.639 [pimatic, ppm] info: Call(int argc, v8::Local argv[]) const { 14:56:40.642 [pimatic, ppm] info: ^~~~ 14:56:41.970 [pimatic, ppm] info: CXX(target) Release/obj.target/serialport/src/serialport_linux.o 14:56:42.154 [pimatic, ppm] info: SOLINK_MODULE(target) Release/obj.target/serialport.node 14:56:42.522 [pimatic, ppm] info: COPY Release/serialport.node 14:56:42.543 [pimatic, ppm] info: make: Leaving directory '/home/pimatic/pimatic-app/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build' 14:56:42.586 [pimatic, ppm] info: > homeduino@0.0.68 postinstall /home/pimatic/pimatic-app/node_modules/pimatic-homeduino/node_modules/homeduino 14:56:42.588 [pimatic, ppm] info: > node -e "require('fs').chmodSync('bin/vhduino', '755')" 14:56:56.660 [pimatic, ppm] info: pimatic-homeduino@0.9.13 node_modules/pimatic-homeduino 14:56:56.662 [pimatic, ppm] info: └── homeduino@0.0.68 (otaat-repl@1.0.2, bluebird@3.5.4, rfcontroljs@0.0.59, serialport@6.2.2) 14:56:56.726 [pimatic] info: Loading plugin: "pimatic-homeduino" (0.9.13) coffee-cache: compiling coffee-script file "homeduino.coffee"...Done 14:57:02.260 [pimatic] error: Unexpected token ILLEGAL

On running pimatic normally:

14:15:55.295 [pimatic] info: Loading plugin: "pimatic-homeduino" (0.9.13) 14:15:55.781 [pimatic] error: Unexpected token ILLEGAL

Config:

{ "driver": "serialport", "driverOptions": { "serialDevice": "/dev/ttyUSB0", "baudrate": 115200 }, "enableReceiving": true, "receiverPin": 0, "transmitterPin": 4, "rfrepeats": 3, "plugin": "homeduino", "active": true, "debug": true },

EDIT: my setup is an arduino conntected to the rpi3

qistoph commented 5 years ago

I'm having the same issue since updating. Also tried a complete reinstall.

Issue is also in 0.9.13:

11:58:41.238 [pimatic] Loading plugin: "pimatic-homeduino" (0.9.13)
coffee-cache: compiling coffee-script file "homeduino.coffee"...Done
11:58:49.379 [pimatic] Unexpected token ILLEGAL
11:58:49.392 [pimatic] SyntaxError: Unexpected token ILLEGAL
qistoph commented 5 years ago

Ok... travelling down the path of the error I've found something suspicious:

# hexdump -C node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/rfcontroljs/lib/protocols/switch13.js | head
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000020  00 00 00 00 00 00 00 00  72 20 62 69 6e 61 72 79  |........r binary|
00000030  54 6f 50 75 6c 73 65 2c  20 70 72 6f 74 6f 63 6f  |ToPulse, protoco|
00000040  6c 49 6e 66 6f 2c 20 70  75 6c 73 65 73 54 6f 42  |lInfo, pulsesToB|
00000050  69 6e 61 72 79 4d 61 70  70 69 6e 67 3b 0a 20 20  |inaryMapping;.  |
00000060  70 75 6c 73 65 73 54 6f  42 69 6e 61 72 79 4d 61  |pulsesToBinaryMa|
00000070  70 70 69 6e 67 20 3d 20  7b 0a 20 20 20 20 27 31  |pping = {.    '1|
00000080  30 27 3a 20 27 31 27 2c  0a 20 20 20 20 27 30 31  |0': '1',.    '01|
00000090  27 3a 20 27 30 27 2c 0a  20 20 20 20 27 32 27 3a  |': '0',.    '2':|

Editing pimatic-homeduino/node_modules/homeduino/node_modules/rfcontroljs/lib/controller.js and removing switch13 from the protocols array does make pimatic-homeduino load without the error.

betz0r commented 5 years ago

Thank you, works now!

qistoph commented 5 years ago

Since it's not really fixed, but just a work around. Maybe this issue should remain open until it's actually fixed...

betz0r commented 5 years ago

Yes, i reopened. It was a missclick.

mwittig commented 5 years ago

CLosing this now. 0.9.15 has been released