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.

    MMM-DailyPokemon Issue

    Scheduled Pinned Locked Moved Solved Troubleshooting
    modules won’t loadconfig.jshelp
    13 Posts 3 Posters 2.7k Views 3 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.
    • mumblebajM Offline
      mumblebaj Module Developer @millis
      last edited by

      @millis You broke config.js. Can you restore it to what it was and then add your MMM-DailyPokemon module. Start the mirror and post the logs. If you start the mirror with pm2 then you can do pm2 logs --lines 50 and post the output. If you use npm then post the output from the terminal where you run npm start

      Check out my modules at: https://github.com/mumblebaj?tab=repositories
      Check my blog-post: https://mumblebaj.xyz/

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        millis @mumblebaj
        last edited by millis

        @mumblebaj
        Thank you for quick response!
        Oh that doesn’t sound ideal…
        Ok I have deleted everything in the config.js and copied the config.js.sample file into it,
        I booted up MagicMirror and it work with the standard few modules it comes with absolutely fine, i then tried adding the Pokemon one again at the bottom but before the “do not edit this line” and still no luck
        Im sure sure how poeple are able to upload there code but ii have just copied it from the terminal

        magicmirror@2.18.0 start
        DISPLAY=“${DISPLAY:=:0}” ./node_modules/.bin/electron js/electron.js

        [14.01.2022 16:55.01.925] [LOG] Starting MagicMirror: v2.18.0
        [14.01.2022 16:55.01.933] [LOG] Loading config …
        [14.01.2022 16:55.01.943] [ERROR] WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/pi/MagicMirror/config/config.js:111
        var config = {
        ^

        SyntaxError: Identifier ‘config’ has already been declared
        at Object.compileFunction (node:vm:352:18)
        at wrapSafe (node:internal/modules/cjs/loader:1038:15)
        at Module._compile (node:internal/modules/cjs/loader:1072:27)
        at Object.Module._extensions…js (node:internal/modules/cjs/loader:1169:10)
        at Module.load (node:internal/modules/cjs/loader:988:32)
        at Module._load (node:internal/modules/cjs/loader:829:12)
        at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
        at Module.require (node:internal/modules/cjs/loader:1012:19)
        at require (node:internal/modules/cjs/helpers:94:18)
        at loadConfig (/home/pi/MagicMirror/js/app.js:69:14)
        [14.01.2022 16:55.01.945] [LOG] Loading module helpers …
        [14.01.2022 16:55.01.970] [LOG] Initializing new module helper …
        [14.01.2022 16:55.01.978] [LOG] Module helper loaded: updatenotification
        [14.01.2022 16:55.01.981] [LOG] No helper found for module: helloworld.
        [14.01.2022 16:55.01.982] [LOG] All module helpers loaded.
        [14.01.2022 16:55.02.112] [LOG] Starting server on port 8080 …
        [14.01.2022 16:55.02.131] [LOG] Server started …
        [14.01.2022 16:55.02.133] [LOG] Connecting socket for: updatenotification
        [14.01.2022 16:55.02.135] [LOG] Starting module helper: updatenotification
        [14.01.2022 16:55.02.135] [LOG] Sockets connected & modules started …
        [14.01.2022 16:55.02.405] [LOG] Launching application.
        [14.01.2022 16:55.04.124] [INFO] Checking git for module: default
        [14.01.2022 16:55.07.417] [LOG] Shutting down server…
        [14.01.2022 16:55.07.419] [LOG] Stopping module helper: updatenotification
        pi@raspberrypi:~/MagicMirror $

        Thank you!

        Ashley.

        I have no clue about anything until i try

        mumblebajM 1 Reply Last reply Reply Quote 0
        • mumblebajM Offline
          mumblebaj Module Developer @millis
          last edited by

          @millis said in MMM-DailyPokemon Issue:

          [14.01.2022 16:55.01.943] [ERROR] WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/pi/MagicMirror/config/config.js:111
          var config = {

          Ok. Post the content of config.js. Once you have pasted the code here, select it all and click the code (</>) button.

          Check out my modules at: https://github.com/mumblebaj?tab=repositories
          Check my blog-post: https://mumblebaj.xyz/

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            millis @mumblebaj
            last edited by millis

            @mumblebaj

            I did wonder how everyone was doing that!
            The only thing I have done is just removed my API Key and location from the weather app as ive seen on here its just good practice to do so?

            Again Thank you for looking into this for me.

            /* Magic Mirror Config Sample
             *
             * By Michael Teeuw https://michaelteeuw.nl
             * MIT Licensed.
             *
             * For more information on how you can configure this file
             * see https://docs.magicmirror.builders/getting-started/configuration.html#general
             * and https://docs.magicmirror.builders/modules/configuration.html
             */
            let 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 or empty, is "localhost"
            	port: 8080,
            	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
            					// you must set the sub path here. basePath must end with a /
            	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"],
            
            	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
            	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
            	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
            
            	language: "en",
            	locale: "en-US",
            	logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
            	timeFormat: 24,
            	units: "metric",
            	// serverOnly:  true/false/"local" ,
            	// local for armv6l processors, default
            	//   starts serveronly and then starts chrome browser
            	// false, default for all NON-armv6l devices
            	// true, force serveronly mode, because you want to.. no UI on this device
            
            	modules: [
            		{
            			module: "alert",
            		},		{
            			module: "updatenotification",
            			position: "top_bar"
            		},
            		{
            			module: "clock",
            			position: "top_left"
            		},
            		{
            			module: "calendar",
            			header: "US Holidays",
            			position: "top_left",
            			config: {
            				calendars: [
            					{
            						symbol: "calendar-check",
            						url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
            					}
            				]
            			}
            		},
            		{
            			module: "compliments",
            			position: "lower_third"
            		},
            		{
            			module: "weather",
            			position: "top_right",
            			config: {
            				weatherProvider: "openweathermap",
            				type: "current",
            				location: "",
            				locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
            				apiKey: ""
            			}
            		},
            		{
            			module: "weather",
            			position: "top_right",
            			header: "Weather Forecast",
            			config: {
            				weatherProvider: "openweathermap",
            				type: "forecast",
            				location: "",
            				locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
            				apiKey: ""
            			}
            		},
            		{
            			module: "newsfeed",
            			position: "bottom_bar",
            			config: {
            				feeds: [
            					{
            						title: "Sky News",
            						url: "https://feeds.skynews.com/feeds/rss/uk.xml"
            					}
            				],
            				showSourceTitle: true,
            				showPublishDate: true,
            				broadcastNewsFeeds: true,
            				broadcastNewsUpdates: true
            			}
            		},
            	]
            };
            
            var config = {
                modules: [
                    {
                        module: "MMM-DailyPokemon",
                        position: "top_center",
                        config: {
                            updateInterval: 600000,
                            minPoke: 4,
                            maxPoke: 151,
                            grayscale: true,
                            showType: true,
                            language: "en",
                            genera: true,
                            gbaMode: true,
                            nameSize: 26,
                            flavorText: false
                        }
                    }
                ]
            }
            
            /*************** DO NOT EDIT THE LINE BELOW ***************/
            if (typeof module !== "undefined") {module.exports = config;}
            

            I have no clue about anything until i try

            mumblebajM 1 Reply Last reply Reply Quote 0
            • mumblebajM Offline
              mumblebaj Module Developer @millis
              last edited by

              @millis said in MMM-DailyPokemon Issue:

              var config = {
              modules: [
              {
              module: “MMM-DailyPokemon”,
              position: “top_center”,
              config: {
              updateInterval: 600000,
              minPoke: 4,
              maxPoke: 151,
              grayscale: true,
              showType: true,
              language: “en”,
              genera: true,
              gbaMode: true,
              nameSize: 26,
              flavorText: false
              }
              }
              ]

              This is your problem. Everything between the square brackets need to be within the previous modules collection i.e. between the previous square brackets “[ ]”.

              Check out my modules at: https://github.com/mumblebaj?tab=repositories
              Check my blog-post: https://mumblebaj.xyz/

              M 1 Reply Last reply Reply Quote 0
              • M Offline
                millis @mumblebaj
                last edited by

                @mumblebaj
                Thank you for looking over my code for me, I really do appreciate it, as i said before I am new to all of this and its just a big mystery to me (for the moment)

                so what would I need to change in my code to fix this?
                from your reply am I right in saying the issue lies with the placement of the square brackets?

                I have tried removing them and that didn’t work and I also moved the code into the module above (inside those square brackets)

                This is the link from where i got the code it was literally a case of following the install instructions followed by a quick copy and paste
                https://github.com/NolanKingdon/MMM-DailyPokemon

                Sorry for being an absolute pain, I really do appreciate you taking up your own time to try and help me!

                Ashley.

                I have no clue about anything until i try

                mumblebajM M 2 Replies Last reply Reply Quote 0
                • mumblebajM Offline
                  mumblebaj Module Developer @millis
                  last edited by mumblebaj

                  @millis You only need this piece of the module config code:

                  {
                              module: "MMM-DailyPokemon",
                              position: "top_center",
                              config: {
                                  updateInterval: 600000,
                                  minPoke: 4,
                                  maxPoke: 151,
                                  grayscale: true,
                                  showType: true,
                                  language: "en",
                                  genera: true,
                                  gbaMode: true,
                                  nameSize: 26,
                                  flavorText: false
                              }
                          }
                  

                  This needs to go into the module block. You can paste it between the alert and clock modules.

                  modules: [
                  		{
                  			module: "alert",
                  		},		{
                  			module: "updatenotification",
                  			position: "top_bar"
                  		},
                  {
                              module: "MMM-DailyPokemon",
                              position: "top_center",
                              config: {
                                  updateInterval: 600000,
                                  minPoke: 4,
                                  maxPoke: 151,
                                  grayscale: true,
                                  showType: true,
                                  language: "en",
                                  genera: true,
                                  gbaMode: true,
                                  nameSize: 26,
                                  flavorText: false
                              }
                          },
                  		{
                  			module: "clock",
                  			position: "top_left"
                  		},
                  

                  Then remove the incorrect code you pasted at the bottom of the file.

                  Check out my modules at: https://github.com/mumblebaj?tab=repositories
                  Check my blog-post: https://mumblebaj.xyz/

                  M 1 Reply Last reply Reply Quote 0
                  • M Offline
                    mickecarlsson @millis
                    last edited by mickecarlsson

                    The previous poster solved it, and I made one mistake in my post.
                    You also need to change let config= to var config=
                    in the beginning of the config.js

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      millis @mumblebaj
                      last edited by

                      @mumblebaj
                      YES!!!

                      Thank you so much!! it works!!!

                      out of interest then how come it gets placed in between the alert and clock and not at the bottom of the code? is it due the position placement on the mirror?

                      Again Thank you so much!!

                      Ashley.

                      I have no clue about anything until i try

                      mumblebajM 1 Reply Last reply Reply Quote 0
                      • mumblebajM Offline
                        mumblebaj Module Developer @millis
                        last edited by

                        @millis You can place it anywhere in the module [ ] block, not outside it like you have done.

                        Check out my modules at: https://github.com/mumblebaj?tab=repositories
                        Check my blog-post: https://mumblebaj.xyz/

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