Read the statement by Michael Teeuw here.
Module: MMM-OpenmapWeather
-
I am using a Raspberry Pi 3B and have set up the basic configuration of Magic Mirror.
I have then gone to activate the Weather module by adding the API Key and when I restart MagicMirror I get the following Syntax Error error message in the Terminal.
Config.js (File details
{ module: "MMM-OpenmapWeather", position: "top_left", // This can be any of the regions. Best results in left or right regions. header: "Current Weather", //Location is the default value if header is empty or not defined. config: { // See 'Configuration options' for more information. location: "Phoenix,USA", locationID: "", //Location ID from http://openweathermap.org/help/city_list.txt appid: "120e565fba4c2008908c1c2ec957140c", //openweathermap.org API key colorIcon: true } }
Terminal Syntax Error
SyntaxError: Unexpected token '{' at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1160:20) at Module._compile (node:internal/modules/cjs/loader:1212:27) at Module._extensions..js (node:internal/modules/cjs/loader:1311:10) at Module.load (node:internal/modules/cjs/loader:1098:32) at Module._load (node:internal/modules/cjs/loader:945:12) at c._load (node:electron/js2c/node_init:2:13672) at Module.require (node:internal/modules/cjs/loader:1122:19) at require (node:internal/modules/helpers:130:18) at loadConfig (/home/synint/MagicMirror/js/app.js:117:14) at App.start (/home/synint/MagicMirror/js/app.js:250:18) at Object.<anonymous> (/home/synint/MagicMirror/js/electron.js:193:7) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1311:10) at Module.load (node:internal/modules/cjs/loader:1098:32) at Module._load (node:internal/modules/cjs/loader:945:12) [2024-04-07 14:26:23.100] [LOG] Loading module helpers ... [2024-04-07 14:26:23.821] [LOG] Initializing new module helper ... [2024-04-07 14:26:23.823] [LOG] Module helper loaded: updatenotification [2024-04-07 14:26:23.825] [LOG] No helper found for module: helloworld. [2024-04-07 14:26:23.828] [LOG] All module helpers loaded. [2024-04-07 14:26:23.847] [LOG] Starting server on port 8080 ... [2024-04-07 14:26:39.288] [LOG] Server started ... [2024-04-07 14:26:39.329] [LOG] Connecting socket for: updatenotification [2024-04-07 14:26:39.331] [LOG] Starting module helper: updatenotification [2024-04-07 14:26:39.333] [LOG] Sockets connected & modules started ... [2024-04-07 14:26:46.150] [LOG] Launching application. [2024-04-07 14:27:14.406] [INFO] System information: ### SYSTEM: manufacturer: Raspberry Pi Foundation; model: Raspberry Pi 3 Model B Plus Rev 1.3; raspberry: [object Object]; virtual: false ### OS: platform: linux; distro: Raspbian GNU/Linux; release: 11; arch: arm; kernel: 6.1.21-v7+ ### VERSIONS: electron: 29.1.6; used node: 20.9.0; installed node: 21.7.1; npm: 10.5.0; pm2: 5.3.1 ### OTHER: timeZone: Europe/London; ELECTRON_ENABLE_GPU: undefined [7961:0407/142804.045780:ERROR:atom_cache.cc(229)] Add WM_CHANGE_STATE to kAtomsToCache ^C/home/synint/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
synint@raspberrypi:~/MagicMirror $
Any help or guidance would be appreciated.
Cheers,
John -
@synint can you show lines 48-60?
unexpected token, 99% of the time means a missing trailing comma, on the line before the line reported, so line 52 in this case
-
@synint said in Module: MMM-OpenmapWeather:
SyntaxError: Unexpected token ‘{’
right above this should be the line number
-
@sdetweil Apologies if I have already posted this response still getting use to the system.
the text above the original post is:
ynint@raspberrypi:~/MagicMirror $ npm run start
magicmirror@2.27.0 start
DISPLAY=“${DISPLAY:=:0}” ./node_modules/.bin/electron js/electron.js[2024-04-07 14:47:03.224] [LOG] Starting MagicMirror: v2.27.0
[2024-04-07 14:47:03.290] [LOG] Loading config …
[2024-04-07 14:47:03.298] [LOG] config template file not exists, no envsubst
[2024-04-07 14:47:03.304] [ERROR] WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/synint/MagicMirror/config/config.js:53I see the line number but still no wiser on what to do.
Cheers,
John -
@synint can you show lines 48-60?
unexpected token, 99% of the time means a missing trailing comma, on the line before the line reported, so line 52 in this case
-
@sdetweil You have made an old man very happy and thank you. Added a comma after the last curly bracket and it now works.