MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

MMM-usonic Problems



  • Hey guys,

    So i am trying to get my ultrasonic sensors to work and i found this module and i was wondering if anyone has had luck trying to get this module to work
    https://github.com/mochman/mmm-usonic @mochman
    Because after following the steps i run the MagicMirror and bunch of errors show up. So if you got this too work please let me know

    Thanks



  • @sgarg15 what errors show up?



  • @sdetweil
    so rn i did the install in the /home/pi/node_modules and i put this in my MMM-Swipe node_helper.js file. (var usonic = require('mmm-usonic'); )

    So then when i run the MagicMirror using npm start these errors show up

    home/pi/MagicMirror/node_modules/electron/dist/electron: symbol lookup error: /home/pi/node_modules/mmm-usonic/build/Release/usonic.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
    npm ERR! code ELIFECYCLE
    npm ERR! syscall spawn
    npm ERR! file sh
    npm ERR! errno ENOENT
    npm ERR! magicmirror@2.10.1 start: `./run-start.sh`
    npm ERR! spawn ENOENT
    npm ERR! 
    npm ERR! Failed at the magicmirror@2.10.1 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2020-03-28T03_18_41_984Z-debug.log
    


  • @sgarg15 said in MMM-usonic Problems:

    so rn i did the install in the /home/pi/node_modules

    what install?

    MMM_Swipe (https://github.com/mochman/MMM-Swipe)

    already lists that dependency in package.json

      "dependencies": {
        "math-statistics": "latest",
        "mmm-usonic": "latest",
        "mmm-gpio": "latest"
      },
    

    and lists that file in node_helper.js

    const usonic = require('mmm-usonic');
    

    the install instructions say

    1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/mochman/MMM-Swipe.git. A new folder labeled MMM-Swipe will appear, cd into it.
    
    2 Execute npm install to install the dependencies
    

    if u are adding a library to a module, then in the module folder

    /home/pi/MagicMirror/modules/module_name   (MMM-Swipe in this case)
    

    you would do

    npm install --save mmm-usonic
    

    if all of that is ok, then sometimes a module ships a library that is built on a specific level of electron,
    and our is different…
    so do

    cd ~/MagicMirror
    npm install electron-rebuild
    node_modules/.bin/electron-rebuild
    

    to rebuild the used libraries to match the installed electron version



  • @sdetweil
    So i tried redownloading the module andi get this error when i npm install

    > electron-rebuild -e ../../node_modules/electron-prebuilt
    
    
    An unhandled error occurred inside electron-rebuild
    Unable to find electron's version number, either install it or specify an explicit version
    
    Error: Unable to find electron's version number, either install it or specify an explicit version
        at /home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:86:19
        at Generator.next ()
        at fulfilled (/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:6:58)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 255
    npm ERR! MMM-Swipe@1.1.1 postinstall: `electron-rebuild -e ../../node_modules/electron-prebuilt`
    npm ERR! Exit status 255
    npm ERR! 
    npm ERR! Failed at the MMM-Swipe@1.1.1 postinstall script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    

    it says it cant find the electron version number, but idk how to fix it



  • @sdetweil
    Any ideas?



  • @sgarg15 maybe can look tomorrow, not home now



  • @sdetweil that module (mmm-usonic) is not for magic mirror, but a library for a potential module to use to talk to the hardware…

    sadly has same labeling and same verbiage (module)

    he wrote MMM-Swipe, which uses his library (mmm-usonic)



  • @sgarg15 to fix the electron rebuild problem,

    the package.json file in MMM-Swipe and change

    this

        "postinstall": "node_modules/.bin/electron-rebuild -e ../../node_modules/electron-prebuilt"
    

    to this

        "postinstall": "node_modules/.bin/electron-rebuild"
    


  • @sdetweil So the install worked properly but then when i ran sudo npm start it gave this error

    [1580:0329/130746.224199:FATAL:electron_main_delegate.cc(211)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
    

    Any idea what that means?


Log in to reply