Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'node-fetch' #104

Closed
Johan-Claesson opened this issue Oct 5, 2023 · 4 comments
Closed

Error: Cannot find module 'node-fetch' #104

Johan-Claesson opened this issue Oct 5, 2023 · 4 comments

Comments

@Johan-Claesson
Copy link

Hello!
Im doing a clean install of MagicMirror using Karsten13's docker image.

Im trying to add one module at a time, and gets an issue when adding MMM-MicrosoftToDo, see error log below.

docker compose file:

version: '3'
services:
  magicmirror:
    container_name: magicmirror
    image: karsten13/magicmirror:latest
    restart: unless-stopped
    volumes:
      - ${APPDATA}/magic_mirror/config:/opt/magic_mirror/config
      - ${APPDATA}/magic_mirror/modules:/opt/magic_mirror/modules
      - ${APPDATA}/magic_mirror/css:/opt/magic_mirror/css
    ports:
      - 8888:8080
    command: 
      - npm
      - run
      - server

Error log:

copy default modules to host ...
copy css files to host ...
chown modules and config folder ...
timezone is Europe/Stockholm
start magicmirror
> [email protected] server
> node ./serveronly
[05.10.2023 11:12.14.796] [LOG]   Starting MagicMirror: v2.25.0
[05.10.2023 11:12.14.798] [LOG]   Loading config ...
[05.10.2023 11:12.14.801] [DEBUG] config template file not exists, no envsubst
[05.10.2023 11:12.14.802] [LOG]   Loading module helpers ...
[05.10.2023 11:12.14.803] [LOG]   No helper found for module: alert.
[05.10.2023 11:12.14.806] [LOG]   Initializing new module helper ...
[05.10.2023 11:12.14.806] [LOG]   Module helper loaded: updatenotification
[05.10.2023 11:12.14.806] [LOG]   No helper found for module: clock.
[05.10.2023 11:12.14.858] [LOG]   Initializing new module helper ...
[05.10.2023 11:12.14.858] [LOG]   Module helper loaded: calendar
[05.10.2023 11:12.14.860] [ERROR] Whoops! There was an uncaught exception...
[05.10.2023 11:12.14.862] [ERROR] Error: Cannot find module 'node-fetch'
Require stack:
- /opt/magic_mirror/modules/MMM-MicrosoftToDo/node_helper.js
- /opt/magic_mirror/js/app.js
- /opt/magic_mirror/serveronly/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._resolveFilename (/opt/magic_mirror/node_modules/module-alias/index.js:49:29)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/opt/magic_mirror/modules/MMM-MicrosoftToDo/node_helper.js:9:15)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at loadModule (/opt/magic_mirror/js/app.js:180:19)
    at loadModules (/opt/magic_mirror/js/app.js:210:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async App.start (/opt/magic_mirror/js/app.js:258:3) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/magic_mirror/modules/MMM-MicrosoftToDo/node_helper.js',
    '/opt/magic_mirror/js/app.js',
    '/opt/magic_mirror/serveronly/index.js'
  ]
}
[05.10.2023 11:12.14.862] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[05.10.2023 11:12.14.863] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

I dont know if this i relevant, but I saw in other issues that the node-version was requested, so here is some metadata I found on the container:

DBUS_SESSION_BUS_ADDRESS unix:path=/var/run/dbus/system_bus_socket
ELECTRON_DISABLE_GPU 1
ELECTRON_DISABLE_SANDBOX 1
MM_OVERRIDE_CSS true
MM_OVERRIDE_DEFAULT_MODULES true
NODE_ENV production
NODE_VERSION 20.8.0
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
YARN_VERSION 1.22.19
@Nosferuity
Copy link

Nosferuity commented Oct 5, 2023

Same issue after upgrade to MM version 2.25.0.
Before the module worked, afterwords MM stays at black screen

@Nosferuity
Copy link

appears that node-fetch has been removed and needs to be replaced MagicMirrorOrg/MagicMirror#2649

@Johan-Claesson
Copy link
Author

Yep! Can confirm that downgrading MM to v2.24.0 solved the issue!

@thobach
Copy link
Owner

thobach commented Nov 16, 2023

I addressed the issue, please try it with the latest commit. Thanks!

@thobach thobach closed this as completed Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants