"dom" variable is undefined



  • I get a console error on start up as follows:

    Uncaught TypeError: Cannot read property ‘appendChild’ of undefined. Meaning the dom variable is undefined.

    The error points to main.js line 38:

    var dom = document.createElement("div");
    dom.id = module.identifier;
    dom.className = module.name;
    
    if (typeof module.data.classes === "string") {
         dom.className = "module " + dom.className + " " + module.data.classes;
    }
    
    dom.opacity = 0;
    wrapper.appendChild(dom);
    

    Everything still works fine, including the custom modules I’ve built, which is actually what drove me to the forum. Since everything works, I’m not actually sure how to debug. Wanted to see if anyone else had this problem or maybe had an easy fix for a fellow perfectionist.


  • Moderator

    Are you running electron app on RasPi or testing in a browser? I had this problem in Chrome when one of the extensions that I had enabled was interfering with MM js



  • @morozgrafix Spot on, I do my dev on my MacBook and test in Chrome. I bet that’s what’s messing with it.


Log in to reply
 

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