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.

    Unable to Run the Head first developing MM module for extreme beginners :(

    Scheduled Pinned Locked Moved Solved Troubleshooting
    3 Posts 2 Posters 969 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.
    • S Offline
      sunnykeerthi
      last edited by

      Hi,

      I’m absolute beginner to developing Magic Mirror Modules, but I’m ver keen and eager to learn and develop them. I started to follow the tutorial available at https://forum.magicmirror.builders/topic/8534/head-first-developing-mm-module-for-extreme-beginners. but the problem here I’m facing is as below. I did a git pull and installed the dependencies. when I did a node serveronly and firing up my chrome browser and heading to the localhost:8080, I’m able to see the clock, compliments, etc… (defaults provided). And as per the tutorial, I went till the getDom() step, and I tried running it, And when I went to my browser and refreshed the window, to my surprise, nothing is shown up, not even Hello, World!, I went to the developer console and searched for myContent , there is no such div created with such class name. :frowning_face:

      Config.js

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information how you can configurate this file
       * See https://github.com/MichMich/MagicMirror#configuration
       *
       */
      
      var config = {
      	address: "localhost", // Address to listen on, can be:
      	// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
      	// - another specific IPv4/6 to listen on a specific interface
      	// - "", "0.0.0.0", "::" to listen on any interface
      	// Default, when address config is left out, is "localhost"
      	port: 8080,
      	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
      	// or add a specific IPv4 of 192.168.1.5 :
      	// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
      	// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
      	// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
      
      	language: "en",
      	timeFormat: 24,
      	units: "metric",
      
      	modules: [
      		{
      			module: "MMM-Test",
      			position: "top_left"
      		},
      	]
      
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") { module.exports = config; }
      
      

      MMM-Test.js

      Module.register("MMM-Timetable", {
        defaults: {},
        start: function () {},
      getDom: function() {
        var element = document.createElement("div")
        element.className = "myContent"
        element.innerHTML = "Hello, World!"
        return element
      },
      notificationReceived: function() {},
        socketNotificationReceived: function() {},
      })
      

      and my developer console output is as below.

      Initializing MagicMirror.
      Loading core translation file: translations/en.json
      Loading core translation fallback file: translations/en.json
      Load script: modules/MMM-Test//MMM-Test.js
      Module registered: MMM-Timetable
      Load stylesheet: css/custom.css
      All modules started!
      

      and below is my folder structure

      0_1539021630852_MagicMirror.png

      Please let me know where am I going wrong guys and please let me know on how can I fix this. Here are my codes.

      Thanks,
      Sunny

      1 Reply Last reply Reply Quote 0
      • S Offline
        sunnykeerthi
        last edited by

        Sorry for my dumbest question guys :frowning_face:. I got it working, changed Module.register("MMM-Timetable", to Module.register("MMM-Test", and its working fine.

        Thanks,
        Sunny

        ? 1 Reply Last reply Reply Quote 0
        • ? Offline
          A Former User @sunnykeerthi
          last edited by

          @sunnykeerthi It’s my fault. But I cannot edit that topic anymore. I don’t know why. -_-a

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            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