chase-cromwell / MMM-Canvas

MagicMirror module to display upcoming assignments from Canvas LMS platform
8 stars 7 forks source link

UnhandledPromiseRejectionWarning Error #2

Open kyllan16693 opened 1 year ago

kyllan16693 commented 1 year ago

After a bit of trouble shooting I found that the canvas module gives this error. Im not sure why, it was working great for a long time then we I pulled the newest magicmirror update and updated my Pi this error kept coming up and the only way to deal with it was by removing the canvas code in my config file.

Full error here:

[12.04.2023 13:40.00.003] [ERROR] (node:11246) UnhandledPromiseRejectionWarning: Error: Cannot find module 'request'
Require stack:
- /home/pi/MagicMirror/modules/MMM-Canvas/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 (node:internal/modules/cjs/loader:963:15)
    at n._resolveFilename (node:electron/js2c/browser_init:2:109751)
    at Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
    at Module._load (node:internal/modules/cjs/loader:811:27)
    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/modules/MMM-Canvas/node_helper.js:8:17)
    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 loadModule (/home/pi/MagicMirror/js/app.js:184:19)
(Use `electron --trace-warnings ...` to show where the warning was created)
[12.04.2023 13:40.00.005] [ERROR] (node:11246) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
RyantheKing commented 1 year ago

I recently updated and had this issue as well. I'm not sure if there is a "correct" way to fix it, but I just ran npm install request --save in the MMM-Canvas directory and that fixed the module error.

kyllan16693 commented 1 year ago

I tried the same thing and still get the original error