kjb085 / MMM-Reddit

Magic Mirror Module for displaying top level content from reddit
34 stars 7 forks source link

Module Broke config.js file - Shows all black only #31

Open Oleson-Cybersec opened 2 years ago

Oleson-Cybersec commented 2 years ago

Good afternoon,

I was looking forward to using this module, but ran into this error where my entire config file wouldn't load after I updated it with your module. I copied it verbatim before I started modifying it to my liking with the chained headlines.

First I cloned the project to ~/MagicMirror/modules:

git clone https://github.com/kjb085/MMM-Reddit.git cd MMM-Reddit npm install --force

Here's my configuration for this module within ~/MagicMirror/config/config.js:

                {
                        module: "MMM-Reddit",
                        postion: "bottom_right",
                        config: {
                                subreddit: ['television', 'science', 'nottheonion'],
                                headerType: 'chained',
                                displayType: 'headlines',
                                count: 14,
                                show: 7,
                                width: 700,
                                showScore: false,
                                showSubreddit: true,
                                colorText: false,
                                showThumbnail: false,
                        }
                },

Here are the errors that occurred when running npm start dev within the ~/MagicMirror directory. Here are the results:

[31.10.2021 19:21.47.956] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module 'request'
Require stack:
- /home/pi/MagicMirror/modules/MMM-Reddit/node_helper.js
- /home/pi/MagicMirror/js/app.js
- /home/pi/MagicMirror/js/electron.js
- /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
-
[31.10.2021 19:21.47.958] [LOG]   Loading module helpers ...
[31.10.2021 19:21.47.958] [LOG]   No helper found for module: alert.
[31.10.2021 19:21.47.959] [LOG]   No helper found for module: clock.
[31.10.2021 19:21.47.960] [LOG]   No helper found for module: weather.
[31.10.2021 19:21.47.961] [LOG]   Initializing new module helper ...
[31.10.2021 19:21.47.961] [LOG]   Module helper loaded: currentweather
[31.10.2021 19:21.47.962] [LOG]   Initializing new module helper ...
[31.10.2021 19:21.47.963] [LOG]   Module helper loaded: calendar
[31.10.2021 19:21.47.963] [LOG]   No helper found for module: MMM-EmbedYoutube.
[31.10.2021 19:21.47.964] [LOG]   No helper found for module: MMM-WiFiPassword.
[31.10.2021 19:21.47.974] [ERROR] App threw an error during load
[31.10.2021 19:21.47.977] [ERROR] Error: Cannot find module 'request'
Require stack:
- /home/pi/MagicMirror/modules/MMM-Reddit/node_helper.js
- /home/pi/MagicMirror/js/app.js
- /home/pi/MagicMirror/js/electron.js
- /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
-
    at Module._resolveFilename (internal/modules/cjs/loader.js:887:15)
    at Function.n._resolveFilename (electron/js2c/browser_init.js:257:1128)
    at Function.Module._resolveFilename (/home/_pi/MagicMirror/node_modules/module-alias/index.js:49:29)
    at Module._load (internal/modules/cjs/loader.js:732:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-Reddit/node_helper.js:6:17)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
[31.10.2021 19:21.47.978] [ERROR] Whoops! There was an uncaught exception...
[31.10.2021 19:21.47.984] [ERROR] Error: Cannot find module 'request'
Require stack:
- /home/pi/MagicMirror/modules/MMM-Reddit/node_helper.js
- /home/pi/MagicMirror/js/app.js
- /home/pi/MagicMirror/js/electron.js
- /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
-
    at Module._resolveFilename (internal/modules/cjs/loader.js:887:15)
    at Function.n._resolveFilename (electron/js2c/browser_init.js:257:1128)
    at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
    at Module._load (internal/modules/cjs/loader.js:732:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-Reddit/node_helper.js:6:17)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/pi/MagicMirror/modules/MMM-Reddit/node_helper.js',
    '/home/pi/MagicMirror/js/app.js',
    '/home/pi/MagicMirror/js/electron.js',
    '/home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js',
    undefined
  ]
}
[31.10.2021 19:21.47.987] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[31.10.2021 19:21.47.987] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
[31.10.2021 19:21.48.245] [LOG]   Launching application.

Then when I comment out the entire MMM-Reddit module, it starts back up like normal again :\

Oleson-Cybersec commented 2 years ago

Also, I wanted to mention that I deleted the entire module since I added the extra step of npm install --force which isn't in your markdown file. So I ran this in order, and then updated the configuration file to uncomment that entire module, which led to the same effect before that made it all black again, with none of my prior modules to work, including a sound module I had (so all of them stopped working, not just visually).

Within the ~/MagicMirror/modules directory

sudo rm -r MMM-Reddit git clone https://github.com/kjb085/MMM-Reddit.git Uncomments MMM-Reddit modules within the config.js file

ErikFunke commented 2 years ago

@OlesonCrypto I ran into the same error as you.

It semms like the node module "request" is not installed in the default dependencies of MM2.

I fixed the issue by installing "request" manually by npm install request.