Read the statement by Michael Teeuw here.
JavaScript error
-
Hi,
I’d appreciate help with resolving this issue:
Thank you!
A JavaScript error occurred in the main process Uncaught Exception: TypeError: styleText is not a function at /home/pi/MagicMirror/js/logger.js:40:42 at Object.<anonymous> (/home/pi/MagicMirror/js/logger.js:114:2) at Module._compile (node:internal/modules/cjs/loader:1141:14) at Module._extensions..js (node:internal/modules/cjs/loader:1196:10) at Module.load (node:internal/modules/cjs/loader:1011:32) at Module._load (node:internal/modules/cjs/loader:846:12) at f._load (node:electron/js2c/asar_bundle:2:13330) at Module.require (node:internal/modules/cjs/loader:1035:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/pi/MagicMirror/js/app.js:7:13) -
@Lmagenis can you tell us more?
how did you install mm, or is this after an update?
if it runs at all there is an info block output in the startup log
if using pm2,
pm2 stop allthen
cd ~/MagicMirror npm run servershow the messages
ctrl-cto stop mm
-
Hi! Thank you for your help!
Here’s the output:
[2026-05-11 08:50:20.288] [LOG] [app] Starting MagicMirror: v2.36.0
[2026-05-11 08:50:20.301] [LOG] [utils] Loading config …
[2026-05-11 08:50:20.310] [INFO] [utils] Checking config file /home/pi/MagicMirror/config/config.js …
[2026-05-11 08:50:20.517] [INFO] [utils] Your configuration file doesn’t contain syntax errors :)
[2026-05-11 08:50:20.519] [INFO] [utils] Checking modules structure configuration …
[2026-05-11 08:50:20.688] [INFO] [utils] Your modules structure configuration doesn’t contain errors :)
[2026-05-11 08:50:20.691] [LOG] [app] Loading module helpers …
[2026-05-11 08:50:20.702] [LOG] [node_helper] Initializing new module helper …
[2026-05-11 08:50:20.703] [LOG] [node_helper] Module helper loaded: updatenotification
[2026-05-11 08:50:20.707] [LOG] [app] No helper found for module: clock.
[2026-05-11 08:50:20.735] [LOG] [node_helper] Initializing new module helper …
[2026-05-11 08:50:20.735] [LOG] [node_helper] Module helper loaded: MMM-Wallpaper
[2026-05-11 08:50:20.737] [WARN] [app] No /home/pi/MagicMirror/modules/MMM-Remote-Control/MMM-Remote-Control.js found for module: MMM-Remote-Control.
[2026-05-11 08:50:20.738] [LOG] [app] No helper found for module: MMM-Remote-Control.
[2026-05-11 08:50:20.739] [LOG] [app] No helper found for module: MMM-Fireworks.
[2026-05-11 08:50:20.742] [LOG] [node_helper] Initializing new module helper …
[2026-05-11 08:50:20.748] [LOG] [node_helper] Module helper loaded: MMM-CalendarExt3
[2026-05-11 08:50:21.461] [LOG] [node_helper] Initializing new module helper …
[2026-05-11 08:50:21.462] [LOG] [node_helper] Module helper loaded: calendar
[2026-05-11 08:50:21.469] [ERROR] [app] Error when loading MMM-TitanSchoolMealMenu: Cannot find module ‘axios’
Require stack:- /home/pi/MagicMirror/modules/MMM-TitanSchoolMealMenu/TitanSchoolsClient.js
- /home/pi/MagicMirror/modules/MMM-TitanSchoolMealMenu/node_helper.js
- /home/pi/MagicMirror/js/app.js
- /home/pi/MagicMirror/serveronly/index.js
[2026-05-11 08:50:21.470] [LOG] [app] No helper found for module: MMM-UselessFacts.
[2026-05-11 08:50:21.629] [LOG] [node_helper] Initializing new module helper …
[2026-05-11 08:50:21.630] [LOG] [node_helper] Module helper loaded: newsfeed
[2026-05-11 08:50:21.631] [LOG] [app] All module helpers loaded.
[2026-05-11 08:50:21.648] [LOG] [server] Starting server on port 8080 …
[2026-05-11 08:50:21.652] [WARN] [server] You’re using a full whitelist configuration to allow for all IPs
[2026-05-11 08:50:21.693] [LOG] [app] Server started …
[2026-05-11 08:50:21.695] [LOG] [node_helper] Connecting socket for: updatenotification
[2026-05-11 08:50:21.696] [LOG] [node_helper] Starting module helper: updatenotification
[2026-05-11 08:50:21.698] [LOG] [node_helper] Connecting socket for: MMM-Wallpaper
[2026-05-11 08:50:21.699] [LOG] [MMM-Wallpaper] Starting node helper for: MMM-Wallpaper
[2026-05-11 08:50:21.700] [LOG] [node_helper] Connecting socket for: MMM-CalendarExt3
[2026-05-11 08:50:21.706] [LOG] [node_helper] Connecting socket for: calendar
[2026-05-11 08:50:21.707] [LOG] [calendar] Starting node helper for: calendar
[2026-05-11 08:50:21.708] [LOG] [node_helper] Connecting socket for: newsfeed
[2026-05-11 08:50:21.710] [LOG] [newsfeed] Starting node helper for: newsfeed
[2026-05-11 08:50:21.712] [LOG] [app] Sockets connected & modules started …
[2026-05-11 08:50:21.714] [INFO] [serveronly]
Ready to go! Please point your browser to: http://0.0.0.0:8080 <<<
[2026-05-11 08:50:22.305] [INFO] [systeminformation]System Information
- SYSTEM: manufacturer: Raspberry Pi Foundation; model: Raspberry Pi 4 Model B Rev 1.5; virtual: false; MM: v2.36.0
- OS: platform: linux; distro: Debian GNU/Linux; release: 12; arch: arm64; kernel: 6.12.62+rpt-rpi-v8
- VERSIONS: electron: undefined; used node: 22.21.1; installed node: 22.21.1; npm: 11.14.1; pm2: 6.0.14
- ENV: XDG_SESSION_TYPE: tty; MM_CONFIG_FILE: undefined
WAYLAND_DISPLAY: undefined; DISPLAY: undefined; ELECTRON_ENABLE_GPU: undefined - RAM: total: 3796.81 MB; free: 3047.70 MB; used: 749.11 MB
- OTHERS: uptime: 44148 minutes; timeZone: America/New_York
-
I added OpenWeatherForecast and updated TitanSchoolMealMenu then the error started. I’ve // out the openweatherforecast on the config file and still get the error. MM doesn’t load and it’s up to date.
-
@Lmagenis the MMM-TitanSchoolMealMenu module removed the axios requirement over a year ago
cd ~/MagicMirror/modules/MMM-TitanSchoolMealMenu git pullif that succeeds, do
npm installthen
cd ~/MagicMirror npm run serverif good, then use browser to go to
http://localhost:8080 -
Now it’s running perfectly if I’m using the browser.
So, why can’t it run if I use “npm start”? -
@Lmagenis you can now… we have debugged, and it works…
ctrl-c to stop server and then do your normal start for MM
-
It returned:
App threw an error during load
TypeError: styleText is not a function
at /home/pi/MagicMirror/js/logger.js:40:42
at Object. (/home/pi/MagicMirror/js/logger.js:114:2)
at Module._compile (node:internal/modules/cjs/loader:1141:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1196:10)
at Module.load (node:internal/modules/cjs/loader:1011:32)
at Module._load (node:internal/modules/cjs/loader:846:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/home/pi/MagicMirror/js/app.js:7:13)
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: styleText is not a function
at /home/pi/MagicMirror/js/logger.js:40:42
at Object. (/home/pi/MagicMirror/js/logger.js:114:2)
at Module._compile (node:internal/modules/cjs/loader:1141:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1196:10)
at Module.load (node:internal/modules/cjs/loader:1011:32)
at Module._load (node:internal/modules/cjs/loader:846:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/home/pi/MagicMirror/js/app.js:7:13)
[405959:0511/092036.982897:ERROR:wayland_connection.cc(224)] Failed to connect to Wayland display: No such file or directory (2)
[405959:0511/092036.983156:ERROR:ozone_platform_wayland.cc(223)] Failed to initialize Wayland platform
[405959:0511/092036.983172:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
The futex facility returned an unexpected error code.
/home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGABRT -
@Lmagenis failed to connect to Wayland display
Npm start was changed to do Wayland, instead of x11
Documented in the release notesNow need to do
npm run start:x11Are you using pm2 to launch?
How did you upgrade MagicMirror? Manually or my scripted update?
-
I’m not using pm2.
I updated from the main MM siteWhen I run npm run start:x11, I’m getting the same error.
-
-
On branch master
Your branch is up to date with ‘origin/master’.Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git restore …” to discard changes in working directory)
modified: package-lock.json
modified: package.jsonUntracked files:
(use “git add …” to include in what will be committed)
RTSPtoWeb/
icons/
installers/
make_error
old_modules/
run-start.sh
splashscreen/no changes added to commit (use “git add” and/or “git commit -a”)
-
-
Here’s what it returned:
diff --git a/package.json b/package.json
index b2c0eca…878e7cc 100644
— a/package.json
+++ b/package.json
@@ -138,7 +138,7 @@
“vitest”: “^4.1.5”
},
“optionalDependencies”: {-
"electron": "^41.3.0"
-
"electron": "^22.3.4" }, "engines": { "node": ">=22.21.1 <23 || >=24"
-
-
@Lmagenis hmm
Do
Stop MagicMirrorcd ~/MagicMirror git checkout package.json rm package-lock.json rm -rf node_modules npm run install-mmStart MagicMirror
-
I’ve always used “npm start”. Tried starting it with both commands.
pi@raspberrypi:~/MagicMirror $ Start MagicMirror
-bash: Start: command not found
pi@raspberrypi:~/MagicMirror $ npm startmagicmirror@2.36.0 start
node --run start:wayland/bin/sh: 1: ./node_modules/.bin/electron: not found
pi@raspberrypi:~/MagicMirror $ -
-
@sdetweil I really appreciate your help with this!
The log has over 600 lines in it. Is there something specific to look for?
-
@sdetweil
The install returned “npm error A complete log of this…” -
@Lmagenis did it succeed or fail,
Without the log
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login