Hello all,
Background:
I am writing this post today about the issues I have been having with all modules involving node_helper.js. To start from the beginning, I recently started a MM project as I had all the parts needed lying around. I flashed the SD to Raspbian GNU/Linux 11 (bullseye) on my Raspberry Pi 3B.
I have successfully installed all default modules and they all work great with no issues. I have also installed MMM-JokeAPI (a module that doesn’t use node_helper.js) and it works fine. It just uses the main module js file and fetches the data in there.
The issue:
I have noticed a strange pattern that seems to be emerging with any modules using node_helper.js. As I speak of these issues, here are the modules that I have tested all having this issue: (MMM-Cocktails, MMM-Dad-Jokes, MMM-DynamicWeather, MMM-RandomQuotes).
**Another note, I know these modules may be “depreciated”, but many of them are very simple. Its just an API request basically. I have looked diligently through all of these for hours and don’t see a reason for the following issues. I have tested all of these API endpoints and the way they parse them. (They all still work)
First, no matter if I include const Log = require("logger");
at the top of a node_helper.js file, I am unable to recieve output from Log.info, Log.log, Log.error or even console.log. I have looked at many forums on this issue, for many looking in the right location fixed this. I have restarted my MM hundreds of times looking at developer tools, the console and using pm2 logs and haven’t seen 1 output from these files. (This really sucks because I cant debug!) For example:
module.exports = NodeHelper.create({
Log.info("Testing this helper");
console.log("TESTING this helper");
start: function() {
console.log("Starting node_helper for: " + this.name);
Log.info("Starting node helper")
},
I have tried sending console output in all of these modules in every location you can think of. I first thought that somehow the logs aren’t reaching the terminal console or the dev tools console, but now, I think these files may not be running at all.
So to test this, in every single one of these modules, I went to the main module class. I found where sendSocketNotification(notification, payload)
was used and did a Log.info(“Sending notification for XYZ module”). (Note, Logging always worked in the main module classes). For every single one of these modules, I got a log showing this bit of code was run.
Now, I went to the spot in the modules main js files where socketNotificationReceived: function(notification, payload) {}
was ran, and put a Log.info(“Recieved notification”) inside the function. None of the modules outputted this log. This is now why I am writing this post, because I am completely lost on what could be going on.
I even just recently tested MMM-RandomQuotes, which just had a github update 5 days ago (presumably works) but I had the same outcome here.
If curious, what these modules look like when starting MM, is their “loading” icons or “loading” text that appears since the API data does not seem to be coming back.
Even with my hours of studying these files and doing research, I will say I’m still very much a beginner to the MagicMirror ins and outs. I would really appreciate any help on this, as I am currently unable to add anything it seems containing a node_helper.js class. Please let me know anything I can provide to help if needed. Thanks! :)