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

Electron failed to install correctly

  • this is the second time i ran into this problem. I couldn’t find anything online for help so I thought I reformat and start over from scratch. but it happen again so it seems like theirs a general error when it comes to the electron file. I followed the step by step guide to installing the magic mirror but when do the final step and start the program I get the following.

    magicmirror@2.1.2 start /home/pi/MagicMirror

    throw new Error(‘Electron failed to install correctly, please delete node_modules/electron and try installing again’)

    Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at Object. (/home/pi/MagicMirror/node_modules/electron/index.js:9:9)
    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.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object. (/home/pi/MagicMirror/node_modules/electron/cli.js:3:16)
    at Module._compile (module.js:570:32)

    npm ERR! Linux 4.9.45-v7+
    npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “start”
    npm ERR! node v6.11.2
    npm ERR! npm v3.10.10
    npm ERR! code ELIFECYCLE
    npm ERR! magicmirror@2.1.2 start: sh
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the magicmirror@2.1.2 start script ‘sh’.
    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 magicmirror package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! sh
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR! npm bugs magicmirror
    npm ERR! Or if that isn’t available, you can get their info via:
    npm ERR! npm owner ls magicmirror
    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/npm-debug.log

    any help would be appropriated and if provided in a simple form because this is the first time ive done anything with a raspberry pi and im not familiar with it.

  • Project Sponsor Module Developer

    @spikeboybebop did you try this? Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

  • So this doesn’t seem very clear. Ive deleted it and try to start magic mirror and I get a black screen. Ive tried to redo the installing of the MM program and nothing changes and no new electron file.

    Ive tried a bunch of different commands for the electron issue from other post. can you be more specific about what I need to install after getting rid of electron?

    also forgot running raspberry pi 3 and the most current OS that is fully up to date.

  • Project Sponsor Module Developer

    @spikeboybebop remove the directory shown in the error and then run npm install in the magicmirror directory

  • @spikeboybebop Hi, maybe my solution posted here may help you:

    The main problem (AFAIK) is the need to install and activate a newer version of node.js, as the installation of electron fails with V 6.x.

    The automatic installer only tests on node.js V5.x, so V6.x seems to be fine, but you need node.js V7.x, at least.


  • @HerrB92 Hm, I just reinstalled stretch on a blank SD and then installed MM using the usual one-liner. Installer updated node to 6.x as usual. Works like a charm.

    pi@mirror:~/MagicMirror $ node -v


  • @michaelb42 Mmmh, good to know. Maybe something has been fixed in node.js V6.x or the ZIP package, which was the actual problem on installing electron (and from there it went further down).

    The indicator was that in the electron folder no path.txt file was created (which triggers the above error message).

    It worked like a charm with V7.x (I even tested it from Raspian scratch). Unfortunately, I have no idea, why the installation result differs that much… 😉


  • Got it to work! I think updating the node is what worked as it was still in version 6. when I did npm install afterwords it added the electron file. I could have sworn I did that before and it didn’t work so maybe it was on my end or the updated node made the difference.

    MM seems to work except for the weather part which initially just showed a thermostat but now is completely missing, everything else is working. shouldn’t be too difficult to figure out that issuer.

    Thanks for all the help and speedy response!

  • Project Sponsor Module Developer

    @spikeboybebop said in Electron failed to install correctly:

    MM seems to work except for the weather

    Weather won’t work without an API key. See the README for that module for instructions on where to go to acquire said API key. Then, enter the API key in the appropriate place in the config entry for that module.

Log in to reply