Read the statement by Michael Teeuw here.
MMM-PublicTransportHafas - Error when loading - DeparturFetcher.mjs
-
Hello together,
i am new to MagicMirror and the coding.
After i updated the module MMM-PublicTransportHafas i get the following error message when starting the mirror.
The modules is not loading anymore.[ERROR] Error when loading MMM-PublicTransportHafas: require() of ES Module /home/Fred/MagicMirror/modules/MMM-PublicTransportHafas/core/DepartureFetcher.mjs not supported.
Instead change the require of /home/Fred/MagicMirror/modules/MMM-PublicTransportHafas/core/DepartureFetcher.mjs to a dynamic import() which is available in all CommonJS modules.Maybe someone can help me.
-
@KristjanESPERANTO can you help here?
-
@Vulan12354 I think it is probably because of the node version. Which version are you using? Run
node -v
to find out. And it would also be interesting to know which MagicMirror version you are using. -
@KristjanESPERANTO
The same problem on my MM. I did all the updates without any problems but since the last update the module does not work.
node is v20.19.1
MM is 2.30.0 -
@Volkae said in MMM-PublicTransportHafas - Error when loading - DeparturFetcher.mjs:
MM is 2.30.0
Okay, I can see this when I downgrade to 2.30.0. With 2.31.0 the issue doesn’t appear. That was not the plan, but I’ll adjust
requiresVersion
accordingly.Please update MM and check whether this solves the issue for you 🙂
-
@Volkae note that you have to update nodejs again this release
use my upgrade script it does all the work
same place as the install script -
@KristjanESPERANTO Not sure if it is advisable to update the modules
requiresVersion
to the latest MM version. With the issue of older PI’s not able to run the latest version of MM you run the risk of the modules no longer working even if they can still work on older versions of MM. I prefer to keep my version 2 versions behind as they worked on those. Unless your module has specifically been updated with dependencies of the latest MM. -
Hi,
I can confirm: I have the same issue.
Updated to latest node and MM version.
Did a npm -install after updating MM and node. Unfortunately it did not have an effect.Any tips ?
Error message:
[2025-05-04 20:17:43.557] [ERROR] Error when loading MMM-PublicTransportHafas: require() of ES Module /home/pi/MagicMirror/modules/MMM-PublicTransportHafas/core/DepartureFetcher.mjs not supported. Instead change the require of /home/pi/MagicMirror/modules/MMM-PublicTransportHafas/core/DepartureFetcher.mjs to a dynamic import() which is available in all CommonJS modules. -
@sdetweil
I used your upgrade script, update is completed, made an new install from MMM-PublicTransportHafas but it does not work -
@Volkae ok, did you do the apply ?
do
node -v cd ~/MagicMirror grep version package.json
MagicMirror version should be 2.31.0