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

Cannot find module 'electron' #8

Open
ColinTravis opened this issue Sep 26, 2024 · 6 comments
Open

Cannot find module 'electron' #8

ColinTravis opened this issue Sep 26, 2024 · 6 comments

Comments

@ColinTravis
Copy link

Using MagicMirror v2.28.0 on Docker. Currently the only module installed. The NPM packages add fine, I have a valid token, but when I reboot the container, MagicMirror crashes with this log:

[2024-09-25 20:27:23.053] [ERROR] Error: Cannot find module 'electron'

Require stack:

- /opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js

- /opt/magic_mirror/modules/MMM-OneDrive/OneDrivePhotos.js

- /opt/magic_mirror/modules/MMM-OneDrive/node_helper.js

- /opt/magic_mirror/js/app.js

- /opt/magic_mirror/serveronly/index.js

    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)

    at Module._resolveFilename (/opt/magic_mirror/node_modules/module-alias/index.js:49:29)

    at Module._load (node:internal/modules/cjs/loader:1051:27)

    at Module.require (node:internal/modules/cjs/loader:1311:19)

    at require (node:internal/modules/helpers:179:18)

    at Object.<anonymous> (/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js:7:19)

    at Module._compile (node:internal/modules/cjs/loader:1469:14)

    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)

    at Module.load (node:internal/modules/cjs/loader:1288:32)

    at Module._load (node:internal/modules/cjs/loader:1104:12)

    at Module.require (node:internal/modules/cjs/loader:1311:19)

    at require (node:internal/modules/helpers:179:18)

    at Object.<anonymous> (/opt/magic_mirror/modules/MMM-OneDrive/OneDrivePhotos.js:11:22)

    at Module._compile (node:internal/modules/cjs/loader:1469:14)

    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)

    at Module.load (node:internal/modules/cjs/loader:1288:32) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    '/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js',

    '/opt/magic_mirror/modules/MMM-OneDrive/OneDrivePhotos.js',

    '/opt/magic_mirror/modules/MMM-OneDrive/node_helper.js',

    '/opt/magic_mirror/js/app.js',

    '/opt/magic_mirror/serveronly/index.js'

  ]

} 
@hermanho
Copy link
Owner

hermanho commented Oct 9, 2024

Please try with version 1.1.1

@ColinTravis
Copy link
Author

ColinTravis commented Oct 9, 2024

Just updated to 1.1.1.
(tried git pull and docker exec -it -w /opt/magic_mirror/modules/MMM-OneDrive magic_mirror npm run install-prod and then I tried just a fresh install)
Still getting this:

[2024-10-08 21:43:27.460] [ERROR] Whoops! There was an uncaught exception... 

[2024-10-08 21:43:27.461] [ERROR] Error: Cannot find module 'electron'

Require stack:

- /opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js

- /opt/magic_mirror/modules/MMM-OneDrive/OneDrivePhotos.js

- /opt/magic_mirror/modules/MMM-OneDrive/node_helper.js

- /opt/magic_mirror/js/app.js

- /opt/magic_mirror/serveronly/index.js

    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)

    at Module._resolveFilename (/opt/magic_mirror/node_modules/module-alias/index.js:49:29)

    at Module._load (node:internal/modules/cjs/loader:1051:27)

    at Module.require (node:internal/modules/cjs/loader:1311:19)

    at require (node:internal/modules/helpers:179:18)

    at openBrowser (/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js:102:27)

    at PublicClientApplication.acquireTokenInteractive (/opt/magic_mirror/modules/MMM-OneDrive/node_modules/@azure/msal-node/dist/client/PublicClientApplication.cjs:135:19)

    at async AuthProvider.getTokenInteractive (/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js:110:26)

    at async AuthProvider.getTokenSilent (/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js:88:16)

    at async AuthProvider.getToken (/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js:74:22)

    at async Auth.<anonymous> (/opt/magic_mirror/modules/MMM-OneDrive/OneDrivePhotos.js:87:31) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    '/opt/magic_mirror/modules/MMM-OneDrive/msal/AuthProvider.js',

    '/opt/magic_mirror/modules/MMM-OneDrive/OneDrivePhotos.js',

    '/opt/magic_mirror/modules/MMM-OneDrive/node_helper.js',

    '/opt/magic_mirror/js/app.js',

    '/opt/magic_mirror/serveronly/index.js'

  ]

} 

@hermanho
Copy link
Owner

hermanho commented Oct 9, 2024

It seems the token.json file is lost in your container. Which directory will be mounted for the docker to store the data?

@ColinTravis
Copy link
Author

Hmm, it was able to find it before, so I don't think it was an issue with how it was mounted. But, currently I have the modules folder mounted:

    volumes:
      - ./modules:/opt/magic_mirror/modules

And within the MMM-Onedrive/msal folder, I have the appropriate files:
image

@hermanho
Copy link
Owner

I tried with a docker version of MM https://khassel.gitlab.io/magicmirror/installation/ and copy the whole MMM-OneDrive from a local version. It is working as well. I think it may be something wrong in the saved credential in the token file.
Please re-auth to create a new one in the local machine and then copy it to the directory.

@ColinTravis
Copy link
Author

That seems to work. I had been using the original token file without generating a new one since the new version dropped.

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

2 participants