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.

    console.Log() shows nothing?

    Scheduled Pinned Locked Moved Solved Development
    19 Posts 8 Posters 17.3k Views 7 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.
    • M Offline
      mortenbirkelund
      last edited by

      @strawberry-3.141 said in console.Log() shows nothing?:

      npm start dev

      Thank you very much, both of you. Now I can see the logs.

      I 1 Reply Last reply Reply Quote 0
      • I Offline
        izanbard @mortenbirkelund
        last edited by

        @mortenbirkelund just a note if you put a console.log() in the node_helper, then it apears on the command line output (or PM2 out.log if you are using PM2)

        1 Reply Last reply Reply Quote 0
        • M Offline
          mortenbirkelund
          last edited by

          Thank you once again for your help. Now that I understand where to see the logs, i can see that my button is not working. Anybody who knows why nothing happens when I click the button

          Module.register("MMM-Slider",{
          
          	// Default module config.
          	defaults: {
          		//text: "Hello World!"
          
          	},
          
          	// Override dom generator.
          	getDom: function() {
          		var wrapper = document.createElement("div");
          		
          		wrapper.appendChild(this.createButton());
          		return wrapper;
          	},
          	
          	createButton: function() {
          		var button = document.createElement("span");
          		button.innerHTML ="Click me";
          		button.id = this.identifier + "_button";
          		
          		button.addEventListener("click", function () {
          			console.log("The button was clicked");
          		});
          
          		return button;
          	}
          	
          });
          
          1 Reply Last reply Reply Quote 0
          • M Offline
            mortenbirkelund
            last edited by

            @Snille I have looked at your button module for inspiration. Do you know why nothing happens when I click the button?

            1 Reply Last reply Reply Quote 0
            • M Offline
              mortenbirkelund
              last edited by

              Found the error. I needed to add

              .region.fullscreen {
              z-index: -1;
              }

              as css and now it is working.

              1 Reply Last reply Reply Quote 0
              • SnilleS Offline
                Snille Module Developer
                last edited by

                Hmm… I don’t have any custom css om my develop-version of MM, but the problem is of course that you will not see the pointer when moving over to the “mirror” if you are using a mouse.
                You can add a custom.css with only:

                body {
                  cursor: pointer;
                 }
                

                then you will see where you “are” when moving the mouse. :)
                But you should not need anything else.

                If you cant find it, make it and share it!
                Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

                1 Reply Last reply Reply Quote 0
                • H Offline
                  hasbean @mortenbirkelund
                  last edited by

                  @mortenbirkelund I know this is really 4 years old, but it was my first match on Google. I couldn’t figure out why logs weren’t printing to terminal.

                  Anyhow, to make Electron print to terminal, add this to the environment variables:

                  ELECTRON_ENABLE_LOGGING=1

                  Hope it helps others!

                  E 1 Reply Last reply Reply Quote 0
                  • E Offline
                    easty @hasbean
                    last edited by

                    @hasbean For a complete beginner, how do you do add that statement to environment variables?

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @easty
                      last edited by

                      @easty in the script that starts mm do

                      export ELECTRON_ENABLE_LOGGING=1

                      or do that before u manually type npm start

                      or use the MMM-Logging module (not mine)

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      E 1 Reply Last reply Reply Quote 0
                      • E Offline
                        easty @sdetweil
                        last edited by easty

                        @sdetweil

                        Getting error EADDRINUSE and MM is blank, though I was trying to debug a module that stopped working yesterday 1st October.

                        At this point, I will delete and reinstall MM and wait for the module developer to update or move to an alternative. I traced the error back to http data request made by node helper js but haven’t been able to find a way to see the console.log or log.info for it. The http link produces json data correctly.

                        Edit

                        Okay this error was to do with the module, I was curious so I deleted the folder for the module and its working again. I can see info logging in terminal.

                        How can I see info logging for node helper js?

                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil @easty
                          last edited by

                          @easty u are using pm2 to launch mm.

                          so open a terminal window and do

                          pm2 status
                          pm2 stop x

                          where x is the name (MagicMirror if you used my install script})
                          or the number in the row of output

                          u don’t have to reinstall

                          pm2 info x

                          will tell you how the process is started mm.sh
                          which is what u would modify

                          using pm2, u can also see the logs by using the command,
                          pm2 logs --lines=???
                          where ??? is a number, 15 by default

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          E 1 Reply Last reply Reply Quote 0
                          • E Offline
                            easty @sdetweil
                            last edited by easty

                            @sdetweil

                            I haven’t installed pm2, I’m updating files through the file manager and using visual code editor. I couldn’t see console logging of node helper through the browser based developer tools but could see it through MM output in its terminal window. So thank you for showing me how to enable logging, that made a big difference.

                            I’ve got the module working again - seems like since yesterday, its decided not to like using https but works find with unsecure http. Through a browser that http link works fine through http or https so was difficult to figure out. Not sure if something changed with the website or with MM http. Most likely the website.

                            Anyway, appreciate the help!

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              sdetweil @easty
                              last edited by

                              @easty if u want to setup using pm2, then there is another script on my page, down at the bottom

                              fixuppm2.sh

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              1 Reply Last reply Reply Quote 0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • 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