Read the statement by Michael Teeuw here.
MMM-PIR-Sensor - White Screen
-
Hi @jwhittaker ,
Previously i had a working node_modules that Ive installed through npm install ( Cant rmb how i got it but i managed to create a back up copy of it). Subsequently when I tried to use npm install on a new raspberry pi, it didnt work as intended.What i did was instead of using npm install, I bypassed it by inserting the node_module that i previously salvaged and it worked for some reasons.
-
Random question for you:
when i try to do an “npm install” in the “MMM-PIR-Sensor” folder, i get the following error:
Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall /home/pi/MagicMirror/modules/MMM-PIR-Sensor electron-rebuild -e …/…/node_modules/electron-prebuilt An unhandled error occurred inside electron-rebuild Unable to find electron-prebuilt’s version number, either install it or specify an explicit version Error: Unable to find electron-prebuilt’s version number, either install it or specify an explicit version at _callee$ (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/electron-rebuild/lib/cli.js:74:17) at tryCatch (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/regenerator-runtime/runtime.js:63:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/regenerator-runtime/runtime.js:337:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/regenerator-runtime/runtime.js:96:21) at GeneratorFunctionPrototype.tryCatcher (/home/pi/node_modules/bluebird/js/release/util.js:16:23) at PromiseSpawn._promiseFulfilled (/home/pi/node_modules/bluebird/js/release/generators.js:97:49) at /home/pi/node_modules/bluebird/js/release/generators.js:201:15 at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/electron-rebuild/lib/cli.js:197:4) at Module._compile (module.js:570:32) at Object.Module._extensions…js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) npm ERR! Linux 4.4.38-v7+ npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” "install" npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE npm ERR! Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall: electron-rebuild -e ../../node_modules/electron-prebuilt npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall script ‘electron-rebuild -e …/…/node_modules/electron-prebuilt’. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the Magic-Mirror-Module-PIR-Sensor package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! electron-rebuild -e …/…/node_modules/electron-prebuilt npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs Magic-Mirror-Module-PIR-Sensor npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls Magic-Mirror-Module-PIR-Sensor npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /home/pi/MagicMirror/modules/MMM-PIR-Sensor/npm-debug.logv
Any idea what could cause this? I suspect my white screen is because the install failed.
I have tried removing the “MMM-PIR-Folder” from my directory and running the clone command from github again to start fresh, but still face this issue.
Note from admin: Please use Markdown on code snippets for easier reading!
-
Similar problem to @Them-Russians when running npm install. Then after starting MM using pm2 I get a white screen. Checking the pm2 error logs I see the following error with a module version mismatch: “Expected 50, got 49”.
0|mm | App threw an error during load 0|mm | Error: Module version mismatch. Expected 50, got 49. 0|mm | at Error (native) 0|mm | at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20) 0|mm | at Object.Module._extensions..node (module.js:583:18) 0|mm | at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20) 0|mm | at Module.load (module.js:473:32) 0|mm | at tryModuleLoad (module.js:432:12) 0|mm | at Function.Module._load (module.js:424:3) 0|mm | at Module.require (module.js:483:17) 0|mm | at require (internal/module.js:20:19) 0|mm | at bindings (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/bindings/bindings.js:76:44)
Tried @James solution using npm rebuild but changed the version parameter to 50. Still no luck.
npm rebuild --runtime=electron --target=1.3.4 --disturl=https://atom.io/download/atom-shell --abi=50
Any help would be much appreciated before I reformat my sd card and start from scratch.
-
@bungee09
npm list
and look for electron to find the right version. Then rerun the rebuild command with replaced version number -
@yawns
Works a treat. Thanks! -
@bungee09 Did you get the
npm install
to work on the “MMM-PIR-Sensor” directory? Or did you just run thenpm list
to get the version of electron and then runnpm rebuild --runtime=electron --target=1.3.4 --disturl=https://atom.io/download/atom-shell --abi=50
with the right version?Which directory were you in when you ran the rebuild?
Sorry - i’m at work now, so dont have the Pi with me, but have been having issues with this for a week now, so i’m really hoping that this works for me :)
-
@Them-Russians - I feel your frustration! I spent a good few hours debugging this after installing and testing my PIR sensor. This is what eventually worked for me:
I ran all the commands in the MMM-PIR-Sensor Directory.
cd ~/MagicMirror/modules/MMM-PIR-Sensor npm list
I found the electron version number to be “1.4.3” so updated target to 1.4.3. Also, updated abi to 50 in the following command as this was the expected value from the error message in pm2 logs.
npm rebuild --runtime=electron --target=1.4.3 --disturl=https://atom.io/download/atom-shell --abi=50
As soon as the rebuild was complete…
cd pm2 restart mm
… to restart MagicMirror in pm2.
I also found this link which described the same fix.
Good luck!
-
@bungee09 Did your rebuild work successfuly? I got an error saying that i needed to have the latest versions of node.js and npm installed.
I believe I have node version 6.9.4. Is that what you were using?
After all this, i thought maybe i jacked up something, so i cleared out and reformatted the micro SD card. I reinstalled NOOBS and then got the Magic Mirror. Created the config.js file and ran the mirror without issue. Immediately after that, i cloned the PIR module and tried to run an “npm install” which failed, and so did the rebuild :(
-
@Them-Russians The rebuild was successful for me using exactly the method I described above. I don’t have my pi with me currently but I only installed node for the first time last week so I definitely don’t have an old version. I can check the exact version number when I get home for you.
-
@Them-Russians
BTW? Did you install node in the main MagicMirror directory first before installing dependencies in the MMM-PIR-Sensor directory?cd ~/MagicMirror npm install