-
Notifications
You must be signed in to change notification settings - Fork 151
Description
OS
Debian 10
NodeJS Version
22
MagicMirror² Version
2.31
Remote Control Version
2.5.3
Did you try using just Remote Control alone with MM?
- I have and the error still happening
Description
MMM-Remote-Control tries to load /MMM-RAIN-MAP/MMM-RAIN-MAP.js, which fails initially, so it tries to build a temp.js file. Loading the reformatted temp.js also fails, which causes an error in the logs.
The error reported on the actual js file and the error reported on the temp.js are different, and only the latter gets reported in the log (which I do not believe is the real error).
temp.js is not deleted, so it just stays there.
Expected behavior
- Ideally, we could somehow tweak Remote-Control to load MMM-RAIN-MAP properly
- The proper error should be reported if not.
- The temp.js file should be cleaned up.
Current behavior
With module MMM-RAIN-MAP, MMM-Remote-Control tries to load the main js file, fails in node_helper.js at line 328.
The apparent error is with the very end of MMM-RAIN-MAP.js where there is an additional (Log) after the usual final }. I could not tell you why it's there, what it does, or why MMM-Remote-Control does not like it (the MMM-RAIN-MAP module works fine on its own).
[2025-04-12 13:29:28.265] [WARN] ReferenceError: Log is not defined
0|mm | at Object.<anonymous> (~/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:28:158622)
0|mm | at Module._compile (node:internal/modules/cjs/loader:1569:14)
0|mm | at Module._extensions..js (node:internal/modules/cjs/loader:1722:10)
0|mm | at Module.load (node:internal/modules/cjs/loader:1296:32)
0|mm | at Module._load (node:internal/modules/cjs/loader:1115:12)
0|mm | at c._load (node:electron/js2c/node_init:2:18008)
0|mm | at TracingChannel.traceSync (node:diagnostics_channel:322:14)
0|mm | at wrapModuleLoad (node:internal/modules/cjs/loader:227:24)
0|mm | at Module.require (node:internal/modules/cjs/loader:1318:12)
0|mm | at require (node:internal/modules/helpers:136:16)
0|mm | at Class.loadModuleDefaultConfig (~/MagicMirror/modules/MMM-Remote-Control/node_helper.js:328:7)
0|mm | at ~/MagicMirror/modules/MMM-Remote-Control/node_helper.js:280:14
0|mm | at FSReqCallback.oncomplete (node:fs:199:5)The above logging had to be added.
The catch block for line 328 says to build a temp.js file to hopefully correct some issues that apparently come from reading bundled apps. That temp.js file is created, but it's no use. Adding some logging shows a DIFFERENT error on the temp file than on the original file:
[2025-04-12 13:54:20.042] [WARN] TypeError: Cannot read properties of undefined (reading 'style')
0|mm | at ~/MagicMirror/modules/temp.js:29:16027
0|mm | at ~/MagicMirror/modules/temp.js:29:149531
0|mm | at Object.<anonymous> (~/MagicMirror/modules/temp.js:29:158621)
0|mm | at Module._compile (node:internal/modules/cjs/loader:1569:14)
0|mm | at Module._extensions..js (node:internal/modules/cjs/loader:1722:10)
0|mm | at Module.load (node:internal/modules/cjs/loader:1296:32)
0|mm | at Module._load (node:internal/modules/cjs/loader:1115:12)
0|mm | at c._load (node:electron/js2c/node_init:2:18008)
0|mm | at TracingChannel.traceSync (node:diagnostics_channel:322:14)
0|mm | at wrapModuleLoad (node:internal/modules/cjs/loader:227:24)
0|mm | at Module.require (node:internal/modules/cjs/loader:1318:12)
0|mm | at require (node:internal/modules/helpers:136:16)
0|mm | at Class.loadModuleDefaultConfig (~/MagicMirror/modules/MMM-Remote-Control/node_helper.js:339:11)
0|mm | at ~/MagicMirror/modules/MMM-Remote-Control/node_helper.js:280:14
0|mm | at FSReqCallback.oncomplete (node:fs:199:5)Again, the above logging had to be added for debug purposes.
After failing on the temp.js, vanilla Remote-Control reports the following error, which is both incorrect and not particularly helpful
[2025-04-12 13:29:28.422] [ERROR] [MMM-Remote-Control] Could not load main module js file. Error found: Cannot read properties of undefined (reading 'style')(I confirmed this to be MMM-RAIN-MAP by some added logging, #330 .)
The temp.js file is never deleted.
So Remote-Control catches an error that (maybe?) it shouldn't catch.
Tries to build a temp.js file to get around an error that is not present.
Reports the wrong error because it reports the error on the temp.js.
And then doesn't delete the temp.js it creates.
Possible solution
Either be more lenient on the ending (Log) in the MMM-RAIN-MAP file, or more accurately report that error? (I tried to delete it from MMM-RAIN-MAP, but it breaks that module).
More carefully select which files get written to temp files?
Clean up temp files after attempt?
Steps to reproduce
Install MMM-RAIN-MAP
Install MMM-Remote-Control
Check logs
Log
See aboveconfig.js
n/aAdditional info
No response