pixxelfriend / MMM-Luftdaten

A MagicMirror² Module to display your air quality sensor data
MIT License
7 stars 0 forks source link

Module not working due to node-fecth #3

Closed Nosferuity closed 1 year ago

Nosferuity commented 1 year ago

Hello,

recently the module cost MM to crash and stay at black screen. This is since the update to 2.25.0 and appears to be connected to node-fetch. As i do not understand much of node-js there ist an issue in the changelog for this version regarding the removal of this function.

"Replace node-fetch with internal fetch (#2649) and remove digest-fetch"

It would be great if this could bee looked at as i like this module

| > magicmirror@2.25.0 start /home/pi/MagicMirror 0|mm | > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js 0|mm | [05.10.2023 15:41.21.641] [LOG] Starting MagicMirror: v2.25.0 0|mm | [05.10.2023 15:41.21.666] [LOG] Loading config ... 0|mm | [05.10.2023 15:41.21.673] [DEBUG] config template file not exists, no envsubst 0|mm | [05.10.2023 15:41.21.691] [LOG] Loading module helpers ... 0|mm | [05.10.2023 15:41.21.700] [LOG] No helper found for module: alert. 0|mm | [05.10.2023 15:41.21.758] [LOG] Initializing new module helper ... 0|mm | [05.10.2023 15:41.21.761] [LOG] Module helper loaded: updatenotification 0|mm | [05.10.2023 15:41.21.766] [LOG] No helper found for module: clock. 0|mm | [05.10.2023 15:41.21.768] [LOG] No helper found for module: MMM-OpenmapWeather. 0|mm | [05.10.2023 15:41.21.784] [ERROR] (node:4096) UnhandledPromiseRejectionWarning: Error: Cannot find module 'node-fetch' 0|mm | Require stack: 0|mm | - /home/pi/MagicMirror/modules/MMM-Luftdaten/node_helper.js 0|mm | - /home/pi/MagicMirror/js/app.js 0|mm | - /home/pi/MagicMirror/js/electron.js 0|mm | - /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js 0|mm | - 0|mm | at node:internal/modules/cjs/loader:1084:15 0|mm | at Function. (node:electron/js2c/browser_init:2:117419) 0|mm | at Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29) 0|mm | at node:internal/modules/cjs/loader:929:27 0|mm | at Function._load (node:electron/js2c/asar_bundle:2:13327) 0|mm | at Module.require (node:internal/modules/cjs/loader:1150:19) 0|mm | at require (node:internal/modules/cjs/helpers:110:18) 0|mm | at Object. (/home/pi/MagicMirror/modules/MMM-Luftdaten/node_helper.js:2:15) 0|mm | at Module._compile (node:internal/modules/cjs/loader:1271:14) 0|mm | at Object..js (node:internal/modules/cjs/loader:1326:10) 0|mm | at Module.load (node:internal/modules/cjs/loader:1126:32) 0|mm | at node:internal/modules/cjs/loader:967:12 0|mm | at Function._load (node:electron/js2c/asar_bundle:2:13327) 0|mm | at Module.require (node:internal/modules/cjs/loader:1150:19) 0|mm | at require (node:internal/modules/cjs/helpers:110:18) 0|mm | at loadModule (/home/pi/MagicMirror/js/app.js:180:19) 0|mm | (Use electron --trace-warnings ... to show where the warning was created) 0|mm | [05.10.2023 15:41.21.787] [ERROR] (node:4096) 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: 1) 0|mm | [4096:1005/154122.324358:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files 0|mm | [4131:1005/154123.251105:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization

pixxelfriend commented 1 year ago

Hello Nosferuity,

it seems that node-fetch is not required anymore since MagicMirror requires node 18 now. I have removed the package from node_helper.js. It should work now with the latest version. Can you please update and confirm?

Cheers

Nosferuity commented 1 year ago

works! Thank you