jalibu/MMM-RAIN-MAP

Error logged during startup

vvrangler opened this issue · 2 comments

Platform

Raspberry Pi 5 running Bookworm

Node.js Version

18.19.0

MagicMirror Version

2.25.0

Module Version

ac9856b

Description

After starting MagicMirror error shows in the log and there is no radar, just the map

Expected behavior

Radar overlay should show on map

Current behavior

Radar layer is missing

Possible solution

No response

Steps to reproduce

Start MagicMirror
Wait for everything to load
Review RAIN-MAP
Missing radar layer
Check Log and see error

Log

MMM-RAIN-MAP.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename MMM-RAIN-MAP.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/vvrangler/MagicMirror/modules/MMM-RAIN-MAP/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

config.js

{
			module: "MMM-RAIN-MAP",
			//position: "bottom_right",
			position: "middle_center",
			//position: "fullscreen_below",
			hiddenOnStartup: true,
			config: {
				animationSpeedMs: 300,
				invertColors: true,
				colorScheme: 4,
				colorizeTime: true,
				defaultZoomLevel: 9,
				displayTime: true,
				displayTimeline: true,
				displayClockSymbol: false,
				displayHoursBeforeRain: 4,
				extraDelayLastFrameMs: 1000,
				extraDelayCurrentFrameMs: 1000,
				markers: [
					{ lat: 38.673110, lng: -120.997270, color: "red" },
					{ lat: 38.658850, lng: -121.150120, color: "blue" },
					{ lat: 38.732590, lng: -120.703780, color: "blue" },
					{ lat: 37.679350, lng: -121.042760, color: "blue" },
					{ lat: 39.523260, lng: -121.577750, color: "blue" },
				],
				mapPositions: [
					{ lat: 38.673110, lng: -120.9972707, zoom: 10, loops: 4 },
					{ lat: 38.673110, lng: -120.9972707, zoom: 9, loops: 3 },
					{ lat: 38.673110, lng: -120.9972707, zoom: 8, loops: 3 },
				],
				mapUrl: "https://a.tile.openstreetmap.de/{z}/{x}/{y}.png",
				mapHeight: "2500px", // must be a pixel value (no percent)
				mapWidth: "1440px", // must be a pixel value (no percent)
				maxHistoryFrames: -1,
				maxForecastFrames: -1,
				substitudeModules: [],
				updateIntervalInSeconds: 300,
			}
		},

Additional info

Thank you

I don't have that problem here with Node.js version 20.4.0

Can you try to upgrade your version?

Updating to 20.4.0 worked. Thank you!