Read the statement by Michael Teeuw here.
unexpected token error
-
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 JSONthis 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, } },
-
There is a comma to much at the end of the keywords array:
"Forecast",
-
@Guku said in unexpected token error:
/home/lolo/MagicMirror/modules/MMM-OpenWeatherMapForecast/package.json
that file…
not your config
-
"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" }
}
-
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" }
}
-
@Guku its missing the leading { as first line
-
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”
}
} -
There is a comma to much at the end of the keywords array:
"Forecast",
-
@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”, ],
-
that was it! thank you so much!
it loads now. -
-
@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.