• 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.

unexpected token error

Scheduled Pinned Locked Moved Solved Troubleshooting
12 Posts 3 Posters 866 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.
  • G Offline
    Guku
    last edited by sdetweil Apr 22, 2024, 3:17 PM Apr 22, 2024, 2:57 PM

    Hello, i ran update for MMM-OpenWeatherMapForecast module and once i restarted MM i get this error

    [ERROR] SyntaxError: Error parsing /home/lolo/MagicMirror/modules/MMM-OpenWeatherMapForecast/package.json: Unexpected token ‘]’, …“ast”,
    ],
    “ma”… is not valid JSON

    this is my config module

    {
    			module: "MMM-OpenWeatherMapForecast",
    			header: "xxxx",
    			position: "top_right",
    			classes: "default everyone",
    			disabled: false,
    			config: {
    			  apikey: "xxxx",
    			  latitude: "xxx",
    			  longitude: "-xxx",      
    			  iconset: "1c",
    			  concise: false,
    			  forecastLayout: "table",
    			  showDailyForecast: true,
    			  maxDailiesToShow: "6",
    			  useAnimatedIcons: true,
    			  animateMainIconOnly: false,
    		   
    		}
    	  },
    
    S 1 Reply Last reply Apr 22, 2024, 3:09 PM Reply Quote 0
    • K Offline
      KristjanESPERANTO Module Developer @sdetweil
      last edited by Apr 22, 2024, 3:49 PM

      There is a comma to much at the end of the keywords array: "Forecast",

      S G 2 Replies Last reply Apr 22, 2024, 3:53 PM Reply Quote 0
      • S Away
        sdetweil @Guku
        last edited by Apr 22, 2024, 3:09 PM

        @Guku said in unexpected token error:

        /home/lolo/MagicMirror/modules/MMM-OpenWeatherMapForecast/package.json

        that file…

        not your config

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        G 2 Replies Last reply Apr 22, 2024, 3:12 PM Reply Quote 0
        • G Offline
          Guku @sdetweil
          last edited by Apr 22, 2024, 3:12 PM

          @sdetweil

          "name": "mmm-openweathermapforecast",
          "version": "1.0.0",
          "description": "MagicMirror² module that gets weather forecast data from OpenWeatherMap",
          "repository": {
              "type": "git",
              "url": "git+https://github.com/MarcLandis/MMM-OpenWeatherMapForecast"
          },
          "keywords": [
              "MagicMirror",
              "MagicMirror²",
              "Weather",
              "OpenWeatherMap",
              "Forecast",
          ],
          "main": "MMM-OpenWeatherMapForecast.js",
          "scripts": {
              "test": "echo \"Error: no test specified\" && exit 1"
          },
          "author": "Jeff Clarke",
          "license": "MIT",
          "dependencies": {
              "moment": "^2.28.0",
              "needle": "^2.5.2"
          }
          

          }

          S 1 Reply Last reply Apr 22, 2024, 3:41 PM Reply Quote 0
          • G Offline
            Guku @sdetweil
            last edited by Apr 22, 2024, 3:40 PM

            @sdetweil

            sorry,

            "name": "mmm-openweathermapforecast",
            "version": "1.0.0",
            "description": "MagicMirror² module that gets weather forecast data from OpenWeatherMap",
            "repository": {
                "type": "git",
                "url": "git+https://github.com/MarcLandis/MMM-OpenWeatherMapForecast"
            },
            "keywords": [
                "MagicMirror",
                "MagicMirror²",
                "Weather",
                "OpenWeatherMap",
                "Forecast",
            ],
            "main": "MMM-OpenWeatherMapForecast.js",
            "scripts": {
                "test": "echo \"Error: no test specified\" && exit 1"
            },
            "author": "Jeff Clarke",
            "license": "MIT",
            "dependencies": {
                "moment": "^2.28.0",
                "needle": "^2.5.2"
            }
            

            }

            1 Reply Last reply Reply Quote 0
            • S Away
              sdetweil @Guku
              last edited by Apr 22, 2024, 3:41 PM

              @Guku its missing the leading { as first line

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              G K 2 Replies Last reply Apr 22, 2024, 3:42 PM Reply Quote 0
              • G Offline
                Guku @sdetweil
                last edited by Apr 22, 2024, 3:42 PM

                @sdetweil

                its there, i copied it wrong

                {
                “name”: “mmm-openweathermapforecast”,
                “version”: “1.0.0”,
                “description”: “MagicMirror² module that gets weather forecast data from OpenWeatherMap”,
                “repository”: {
                “type”: “git”,
                “url”: “git+https://github.com/MarcLandis/MMM-OpenWeatherMapForecast”
                },
                “keywords”: [
                “MagicMirror”,
                “MagicMirror²”,
                “Weather”,
                “OpenWeatherMap”,
                “Forecast”,
                ],
                “main”: “MMM-OpenWeatherMapForecast.js”,
                “scripts”: {
                “test”: “echo "Error: no test specified" && exit 1”
                },
                “author”: “Jeff Clarke”,
                “license”: “MIT”,
                “dependencies”: {
                “moment”: “^2.28.0”,
                “needle”: “^2.5.2”
                }
                }

                1 Reply Last reply Reply Quote 0
                • K Offline
                  KristjanESPERANTO Module Developer @sdetweil
                  last edited by Apr 22, 2024, 3:49 PM

                  There is a comma to much at the end of the keywords array: "Forecast",

                  S G 2 Replies Last reply Apr 22, 2024, 3:53 PM Reply Quote 0
                  • S Away
                    sdetweil @KristjanESPERANTO
                    last edited by sdetweil Apr 22, 2024, 3:55 PM Apr 22, 2024, 3:53 PM

                    @KristjanESPERANTO said in unexpected token error:

                    There is a comma to much at the end of the keywords array: “Forecast”,

                    javascript is very accepting of TOO MANY commas…
                    and NOT accepting of not enough .

                    but I don’t understand what MM is complaining about the package.json

                    unless its the enhancement to updateNotification…

                    [ERROR] SyntaxError: Error parsing /home/lolo/MagicMirror/modules/MMM-OpenWeatherMapForecast/package.json: Unexpected token ‘]’, …“ast”,
                    ],
                    

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    K 1 Reply Last reply Apr 22, 2024, 6:14 PM Reply Quote 0
                    • G Offline
                      Guku @KristjanESPERANTO
                      last edited by Apr 22, 2024, 3:57 PM

                      @KristjanESPERANTO

                      that was it! thank you so much!
                      it loads now.

                      1 Reply Last reply Reply Quote 1
                      • S sdetweil has marked this topic as solved on Apr 22, 2024, 4:30 PM
                      • K Offline
                        KristjanESPERANTO Module Developer @sdetweil
                        last edited by Apr 22, 2024, 6:14 PM

                        @sdetweil said in unexpected token error:

                        javascript is very accepting of TOO MANY commas…

                        That’s right about JavaScript. But trailing commas are a syntax error in JSON files.

                        S 1 Reply Last reply Apr 22, 2024, 6:18 PM Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        1 / 2
                        • First post
                          9/12
                          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