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

"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"); = module.identifier;
    dom.className =;
    if (typeof === "string") {
         dom.className = "module " + dom.className + " " +;
    dom.opacity = 0;

    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