• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

"dom" variable is undefined

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 2 Posters 2.7k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jeremytripp
    last edited by Jan 19, 2017, 5:44 PM

    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.

    1 Reply Last reply Reply Quote 0
    • M Offline
      morozgrafix Moderator
      last edited by Jan 19, 2017, 5:53 PM

      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

      J 1 Reply Last reply Jan 19, 2017, 6:04 PM Reply Quote 0
      • J Offline
        jeremytripp @morozgrafix
        last edited by Jan 19, 2017, 6:04 PM

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

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy