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

Error when running sudo npm install. magicmirror@2.3.1 cd vendor && yon install (wd=/home/pi/MagicMirror)



  • I am trying to get Magic Mirror running on my Pi Zero W headless. I have followed a few different tutorials, mostly saying the same stuff, and I was able to get Magic Mirror, Node, and npm installed fine, but when I run “sudo npm install” I get the error pictured below. I thought it was because nodejs was not up to date, but I have updated it and it is still not working.

    0_1524507375482_Screen Shot 2018-04-23 at 2.07.34 PM.png



  • @greenwaydev said in Error when running sudo npm install. magicmirror@2.3.1 cd vendor && yon install (wd=/home/pi/MagicMirror):

    Magic Mirror running on my Pi Zero W headless. I have followed a few different tutorials, mostly saying the same stuff, and I was

    The error occurs due to incompatible peer dependencies. Npm (recently) introduced the concept of peer dependencies which are dependencies expected to be provided separately to ensure compatibility between different apis.

    I am surprised that in your case mm fails to finish the installation as for me I only get a warning.

    My attempt to fix this would be to:
    For now try run sudo npm i stylelint@latest before running sudo npm install

    If this does not work change the config file to include "stylelint": "^9.0.0" instead of "stylelint": "^8.4.0" and try again.

    Be aware that you usually should never do the second step if you don’t exactly know what you are doing. Upgrading a major version (the version number at the very beginning) indicates a new release with potential api breaking changes. (If semversioning is used). But since your error log indicates that stylelint config is happy with either version, and the dependency is not really used “in production” this might be worth a shot.



  • Ok I did what you said and it told me that nodejs needed to be a more recent version so I updated it again to a version that is acceptable. This is the error I am getting now.

    0_1524526014108_Screen Shot 2018-04-23 at 7.26.09 PM.png

    Then, my basic CLI knowledge made me think I should add sudo so…

    0_1524526077438_Screen Shot 2018-04-23 at 7.26.27 PM.png

    Any advice?


  • Module Developer

    I could be mistaken but I believe that using sudo npm install can cause problems. Installation of MM and its dependencies should be done as a normal user.

    For what it’s worth.



  • @Mykle1 said in Error when running sudo npm install. magicmirror@2.3.1 cd vendor && yon install (wd=/home/pi/MagicMirror):

    I could be mistaken but I believe that using sudo npm install can cause problems. Installation of MM and its dependencies should be done as a normal user.

    For what it’s worth.

    Good point. I just saw his sudo npm install and followed along without thinking.
    You can try to uninstall stylelint again with npm uninstall stylelint(with or without sudo , whatever works) and install it again without the sudo command.
    If this does not yield any success in this issue someone fixed a similar warning (https://github.com/KraigM/homebridge-harmonyhub/issues/97).
    Never the less this shouldn’t all be necessary. Maybe it’s time to start over frech again and really be cautious about every step you do.