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

Node.js Compile Version Mis-Matches?



  • I’m trying to MMM-MP3Player up and running to play music locally.

    Following the install instructions on GitHub, I added the 3 dependencies listed, then cloned the MMM-MP3Player project down as instructed.

    Now when starting up the MagicMirror, I’m getting the following:

    [2020-06-03 09:44:27.792] [LOG]    Whoops! There was an uncaught exception...
    [2020-06-03 09:44:27.793] [ERROR]  Error: The module '/home/pi/MagicMirror/modules/MMM-MP3Player/node_modules/usb/build/Release/usb_bindings.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 64. This version of Node.js requires
    NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
        at process.func (electron/js2c/asar.js:138:31)
        at process.func [as dlopen] (electron/js2c/asar.js:138:31)
        at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
        at Object.func (electron/js2c/asar.js:138:31)
        at Object.func [as .node] (electron/js2c/asar.js:138:31)
        at Module.load (internal/modules/cjs/loader.js:645:32)
        at Function.Module._load (internal/modules/cjs/loader.js:560:12)
        at Module.require (internal/modules/cjs/loader.js:685:19)
        at require (internal/modules/cjs/helpers.js:16:16)
        at bindings (/home/pi/MagicMirror/modules/MMM-MP3Player/node_modules/bindings/bindings.js:112:48)
    

    Based on a similar issue/troubleshooting I found, I have done:

    cd /MagicMirror/modules/MMM-MP3Player
    rm -rf node_modules/usb
    npm cache clear
    rm package-lock.json
    npm i
    

    It does some work to rebuild/install the MMM-MP3Player module again, but I still receive the same error when starting up the MagicMirror next time.

    I then tried the 2nd and 3rd highest proposed solutions on there (electron-rebuild and –update-binary, but wind up with same error each time when trying to launch the MagicMirror.

    I’m guessing there is a different file that needs to be rebuilt, or a way to force using a specific version of Node.js?



  • @pillbug22 do

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

  • Module Developer

    @sdetweil : are you sure of this ?
    install and execute electron rebuild inside main MM core !?



  • @Bugsounet sure, it will find what it needs to rebuild


  • Module Developer

    and scan … ALL modules …



  • @Bugsounet so, it will do it quickly… go get some coffee… everything not done in 2 seconds! lol


  • Module Developer

    lol

    so the better thing is that :
    install electron rebuild inside the module desired (there MMM-MP3Player)

    cd ~/MagicMirror/modules/MMM-MP3Player
    npm install electron-rebuild
    

    and execute it

    ./node_modules/.bin/electron-rebuild
    


  • @Bugsounet better not to install it 12 times , just one in MM, then maybe use in module folder…

    too many modules need rebuild


  • Module Developer

    I have already tried it but sometimes … it remakes the queue with the other modules and crashes … that’s why I abandoned this method. otherwise on principle i agree with you 🙂

    after … like i say : “If it want to works like this … let’s go on !”


  • Module Developer

    I think MM needs to escape from the dependency of Electron. (Frankly, it is needed only for fullscreen kiosk front, not using any advanced benefits of Electron itself)
    or at least modules need to use worker-threading or spawning child process which would be independent from Electron process environment to work with node’s native-modules.


Log in to reply