thobach / MMM-Gestures

MMM-Gestures is a head-less 3rd party module for MagicMirror that allows to control the Magic Mirror via gestures of two types of infrared sensors. Use cases include presence awareness to trigger compliments or go into sleep mode and scrolling through news tickers or view news details.
http://blog.thomas-bachmann.com/2016/02/magic-mirror-2-0-mit-gestensteuerung.html
41 stars 12 forks source link

MMM-Gestures npm install fails with errors #13

Closed McMornan closed 2 years ago

McMornan commented 2 years ago

Hi,

after creating the pull request I also updated my MM2 installation. Now an npm install fails with a number of errors:

pi@valuedisplay:~/MagicMirror/modules/MMM-Gestures $ npm install

Magic-Mirror-Module-Gestures@1.0.0 postinstall $(npm bin)/electron-rebuild

⠧ Building module: bindings, Completed: 0make: Verzeichnis „/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/@serialport/bindings/build“ wird betreten CXX(target) Release/obj.target/bindings/src/serialport.o ⠹ Building module: bindings, Completed: 0In file included from /home/pi/.electron-gyp/16.0.6/include/node/v8-local-handle.h:12, from /home/pi/.electron-gyp/16.0.6/include/node/v8-array-buffer.h:12, from /home/pi/.electron-gyp/16.0.6/include/node/v8.h:25, from /home/pi/.electron-gyp/16.0.6/include/node/node.h:63, from ../../../nan/nan.h:58, from ../src/./serialport.h:13, from ../src/serialport.cpp:1: /home/pi/.electron-gyp/16.0.6/include/node/v8-internal.h:471:71: warning: left shift count >= width of type [-Wshift-count-overflow] static constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32; ^~ /home/pi/.electron-gyp/16.0.6/include/node/v8-internal.h:471:68: error: right operand of shift expression ‘(1 << 32)’ is >= than the precision of the left operand [-fpermissive] static constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32;


/home/pi/.electron-gyp/16.0.6/include/node/v8-internal.h:472:69: warning: left shift count >= width of type [-Wshift-count-overflow]
   static constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
                                                                     ^~
/home/pi/.electron-gyp/16.0.6/include/node/v8-internal.h:472:66: error: right operand of shift expression ‘(1 << 32)’ is >= than the precision of the left operand [-fpermissive]
   static constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
                                                        ~~~~~~~~~~^~~~~
⠏ Building module: bindings, Completed: 0In file included from /home/pi/.electron-gyp/16.0.6/include/node/v8.h:53,
                 from /home/pi/.electron-gyp/16.0.6/include/node/node.h:63,
                 from ../../../nan/nan.h:58,
                 from ../src/./serialport.h:13,
                 from ../src/serialport.cpp:1:
/home/pi/.electron-gyp/16.0.6/include/node/v8-script.h:230:79: warning: ‘ResolveCallback’ is deprecated [-Wdeprecated-declarations]
                                                       ResolveCallback callback);
                                                                               ^
⠦ Building module: bindings, Completed: 0../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Open(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:78:69: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Open, (uv_after_work_cb)EIO_AfterOpen);
                                                                     ^~~~~~~~~~~~~
⠧ Building module: bindings, Completed: 0../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Update(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:135:71: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Update, (uv_after_work_cb)EIO_AfterUpdate);
                                                                       ^~~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Close(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:175:70: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Close, (uv_after_work_cb)EIO_AfterClose);
                                                                      ^~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Flush(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:215:70: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Flush, (uv_after_work_cb)EIO_AfterFlush);
                                                                      ^~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Set(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:271:68: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Set, (uv_after_work_cb)EIO_AfterSet);
                                                                    ^~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Get(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:316:68: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Get, (uv_after_work_cb)EIO_AfterGet);
                                                                    ^~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE GetBaudRate(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:366:76: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_GetBaudRate, (uv_after_work_cb)EIO_AfterGetBaudRate);
                                                                            ^~~~~~~~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Drain(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:412:70: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Drain, (uv_after_work_cb)EIO_AfterDrain);
                                                                      ^~~~~~~~~~~~~~
../src/serialport.cpp: At global scope:
../src/serialport.cpp:433:28: warning: unnecessary parentheses in declaration of ‘ToParityEnum’ [-Wparentheses]
 SerialPortParity NAN_INLINE(ToParityEnum(const v8::Local<v8::String>& v8str)) {
                            ^
../src/serialport.cpp:452:30: warning: unnecessary parentheses in declaration of ‘ToStopBitEnum’ [-Wparentheses]
 SerialPortStopBits NAN_INLINE(ToStopBitEnum(double stopBits)) {
                              ^
In file included from ../../../nan/nan.h:58,
                 from ../src/./serialport.h:13,
                 from ../src/serialport.cpp:1:
/home/pi/.electron-gyp/16.0.6/include/node/node.h:821:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/pi/.electron-gyp/16.0.6/include/node/node.h:855:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/serialport.cpp:486:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(serialport, init);
 ^~~~~~~~~~~
⠴ Building module: bindings, Completed: 0make: *** [bindings.target.mk:124: Release/obj.target/bindings/src/serialport.o] Fehler 1
make: Verzeichnis „/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/@serialport/bindings/build“ wird verlassen
✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/@serialport/bindings'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `make` failed with exit code: 2

Error: node-gyp failed to rebuild '/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/@serialport/bindings'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `make` failed with exit code: 2

    at NodeGyp.rebuildModule (/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:117:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async ModuleRebuilder.rebuildNodeGypModule (/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/electron-rebuild/lib/src/module-rebuilder.js:94:9)
    at async ModuleRebuilder.rebuild (/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/electron-rebuild/lib/src/module-rebuilder.js:124:14)
    at async Rebuilder.rebuildModuleAt (/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/electron-rebuild/lib/src/rebuild.js:145:13)
    at async Rebuilder.rebuild (/home/pi/MagicMirror/modules/MMM-Gestures/node_modules/electron-rebuild/lib/src/rebuild.js:108:17)
    at async /home/pi/MagicMirror/modules/MMM-Gestures/node_modules/electron-rebuild/lib/src/cli.js:154:9
npm ERR! code 255
npm ERR! path /home/pi/MagicMirror/modules/MMM-Gestures
npm ERR! command failed
npm ERR! command sh -c $(npm bin)/electron-rebuild

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2022-01-04T18_57_01_105Z-debug-0.log

</code>
SaschaSp commented 2 years ago

Have the same Issue. The solution was with the help from Tom-Hirschberger (MMM-Serial-Notifications)

 cd MagicMirror/modules/MMM-Gestures
 sudo nano package.json

change in line 30: "postinstall": "$(npm bin)/electron-rebuild" to "postinstall": "node_modules/.bin/MagicMirror-rebuild"

save and exit nano In the MMM-Gestures folder npm install

When the Mirror don´t recognize the gestures, check the hint from thobach: _Note: If you use an older Raspberry Pi 2 or operating system (vs. 3), you may need to change the USB device name in https://github.com/thobach/MMM-Gestures/blob/master/node_helper.js#L104 from ACM to USB_

Maybe thobach can check and apply the changes.

McMornan commented 2 years ago

Hi,

thanks for the suggestion. I made the change as you adviced, but MagicMirror-rebuild was neither in the node_modules/.bin nor the parent MagicMirror/node_modules/.bin directory. But thanks for the hint regarding MMM-Serial-Notifications! I guess I will change to that. Seems much more flexible !

Lars

thobach commented 2 years ago

Thanks for the hint, I updated this MMM module to use the MagicMirror-rebuild approach instead as well.