Adding new modules leads to irreversible error



  • Sometimes when I add a new module, I get the following error message:

    DISPLAY=:0 npm start
    
    > magicmirror@2.1.1 start /home/pi/MagicMirror
    > sh run-start.sh
    
    Starting MagicMirror: v2.1.1
    Loading config ...
    Loading module helpers ...
    No helper found for module: alert.
    WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module 'node_helper'
    Loading module helpers ...
    No helper found for module: alert.
    App threw an error during load
    Error: Cannot find module 'node_helper'
        at Module._resolveFilename (module.js:470:15)
        at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
        at Function.Module._load (module.js:418:25)
        at Module.require (module.js:498:17)
        at require (internal/module.js:20:19)
        at Object. (/home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:6:18)
        at Object. (/home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:89:3)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32)
    Whoops! There was an uncaught exception...
    { Error: Cannot find module 'node_helper'
        at Module._resolveFilename (module.js:470:15)
        at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
        at Function.Module._load (module.js:418:25)
        at Module.require (module.js:498:17)
        at require (internal/module.js:20:19)
        at Object. (/home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:6:18)
        at Object. (/home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:89:3)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32) code: 'MODULE_NOT_FOUND' }
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    Launching application.
    

    MM2 is not working in this case (independent of the config.js). Deleting the module does not revert the problem. Sometimes, a complete reinstall of MM2 including all past and the new module works, sometimes it does not. I don’t have a clue, what determines success.

    Any ideas, how to avoid / repair this?

    I tried

    npm rebuild
    

    without success.

    Thanks for your help!


  • Module Developer

    The config file is incorrect… it says so right here:

    WARNING! Could not load config file.

    The alert module has no node_helper… it’s a bad config file…

    So post your config file so we can look at it.


  • Module Developer

    @rudibarani said in Adding new modules leads to irreversible error:

    Any ideas, how to avoid / repair this?

    It sounds to me as if you’re able to get MM up and running, at least sometimes and that you’re problem occurs when attempting to add other modules. Is this the case? If so, then it is the manner in which you add the modules that is suspect. Are you cloning the modules into your `MagicMirror/modules $ directory?

    Example:

    pi@Pi3:~/MagicMirror/modules $ git clone https://github.com/mykle1/MMM-Events.git

    Then, when adding your module entry into the config.js file you have to be precise. If you make a mistake there then your mirror won’t run but it doesn’t mean you need to reinstall. And simply deleting the module won’t help unless you delete or correct the problem from the config.js file.

    Start with a new copy of the config.js.sample file and rename it to config.js. Then when you add a new module to that you can copy and paste it here and I/we’ll check it for you


  • Module Developer

    @Mykle1 said in Adding new modules leads to irreversible error:

    Then when you add a new module to that you can copy and paste it here and I/we’ll check it for you

    Yes add one at a time and make sure the mirror works… if you add one and it errors you know where the problem is.



  • @Mykle1 MM was / is running fine when adding new modules. So I think the problem does not stem from the config.js file in the first place. I add new modules exactly as you and each developer describes. My new additions last evening where:

    • MMM-Traffic
    • MMM-TrafficCal
    • MMM-MyWeather
    • MMM-Wunderground

    All of them immediately broke my system after installing the module. This happened even without touching the config.js file! Removing the module from the folder again did not solve the problem.

    After a complete reinstall of MM (deletion of the whole MM-folder) with all my current modules plus MMM-Traffic / MMM-TrafficCal the system worked fine with the sample config.js. I also tried my own config.js which incorporated the new models afterwards and it worked fine, too.

    Then I wanted to add MMM-MyWeather / MMM-Wunderground. These were cloned to the modules folder and the system stopped working again. This time, a complete reinstall with all current modules plus one of these two did not solve the problem. As many people use these modules, I am sure these would generally run fine and the problem must be rooted somewhere else.

    All together, it seems to me that MM screens the modules folder independent of the config.js file and throws the error. Is that possible?

    Are there any other things I could check like correct versions of software MM depends on?
    The only software I noticed during install was node which is version v6.10.3 and thus newer than the 5.xx.xx version described as necessary.

    Thanks for all the feedback so far and willingness to help!


  • Module Developer

    @rudibarani said in Adding new modules leads to irreversible error:

    I am sure these would generally run fine and the problem must be rooted somewhere else.

    I am sure of that, too. However, it is impossible to know how each person’s Pi is setup. I/we are working on the assumption that yours was done correctly. This is why 2 of us have asked for you to post your config.js here so that we could eliminate that as a possibility. So far, you haven’t done so. Basically, you’re telling us you’ve done everything correctly and then asking us why it’s not working.

    All together, it seems to me that MM screens the modules folder independent of the config.js file and throws the error. Is that possible?

    No, I don’t think so. MM is looking at your config.js file first, to see what modules to load. It wouldn’t throw an error for a module that it isn’t being asked to load

    Are there any other things I could check like correct versions of software MM depends on?

    Some modules require dependencies, as does MM itself. These should have been done during installation of both. I would make sure you have the latest node (which you seem to already have) and npm.

    The only software I noticed during install was node which is version v6.10.3 and thus newer than the 5.xx.xx version described as necessary.

    What is needed, if you still require help, is for you to post your config.js, your terminal output (which may be showing errors), and your console output from your dev tools.


  • Module Developer

    @rudibarani said in Adding new modules leads to irreversible error:

    My new additions last evening where:

    MMM-Traffic
    MMM-TrafficCal
    MMM-MyWeather
    MMM-Wunderground

    Well that tells me either you didn’t install them correctly or they are not in the config.js properly. This is not MM’s fault. IF it was working before you added them then something within those additions is incorrect. SO take them ALL out of your config.js file and see if MM runs. IF it does then enter them ONE at a time and restart your mirror to ensure that there is no problem.

    If you don’t want to do that or post your config file then really there isn’t much anyone can do to help you. It’s like doing surgery in the dark…

    Simply adding modules then blaming MM isn’t really solving anything. It’s user error and that’s the easiest way I can put it. Again, if you want help please listen and read what people are asking you to do they are trying to help. If you’re not willing to do that I’m afraid there is little anyone can do to help.

    People that are here donating their time to further a project … but they cannot spend hours trying to guess at what the problem is. SO they ask for things to better help you.



  • Thanks everyone. I have a freshly installed Raspbian with Jessie, made sure NodeJS is up to date and installed MM2. That workes fine (except for one cosmetic error message from a bash script I describe in another post). This error only occurs when installing MM2 via the one-line-installer promoted on the website. The problem I describe occurred independent of the way I install MM2z

    MM2 runs fine with the sample config.js and throws the error I describe sometimes, but not always, when adding new modules. This happens without touching the standard config.js that came with MM as sample. It even happens during several rounds of completely deleting the MagicMirror-Folder and re-installing MM2 from
    scratch.

    That’s why I think the problem is independent of my or any config.js file. As you all imply that adding new modules should not change a thing unless I refer to them in the config.js, something else must be wrong.

    As the problem persists after several re-installations of MM2, it must be based either within it, as an unknown bug, or somewhere in the dependencies outside the application.

    Next, I will completely wipe my SD card and reinstall Raspbian to see if that helps…


  • Module Developer

    @rudibarani IF the mirror runs fine the error is of no concern. They know it’s there but it hasn’t been a problem.

    Good luck.



  • Hi everyone,
    thanks for your help and feedback. I have completely wiped my system and started again from scratch. This time, I can add modules without any errors. This indicates, that there likely was a problem with the framework nodejs and or MM2 depended on.

    There is one noticeable difference: When I am connected using SSH, I can only start the Mirror using

    node serveronly
    

    The command I used up to now

    DISPLAY=:0 npm start
    

    does not work any more.
    Is this intended behaviour?


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.