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

Could not validate main module js file. ReferenceError: window is not defined #18

Closed
PH1TCH opened this issue Aug 29, 2021 · 8 comments
Closed

Comments

@PH1TCH
Copy link

PH1TCH commented Aug 29, 2021

Hello and thank you for opening an issue.

I found a bug in this module

Please make sure to only submit reproducible issues.
When submitting a new issue, please supply the following information:

Platform: Place your platform here... give us your web browser/Electron version and your hardware (Raspberry Pi 2/3/4, Windows, Mac, Linux, System V UNIX).
Raspberry Pi 4, Electron 13.2.3

Node Version: Make sure it's version 10 or later.
Node 14.17.5

MagicMirror Version: Please let us now which version of MagicMirror you are running. It can be found in the package.log file.
MM 2.16.0

Description: Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.
Error shows up in the logs with "pm2 logs"

0|mm | [29.08.2021 13:07.10.633] [ERROR] ERROR! Could not validate main module js file. 0|mm | [29.08.2021 13:07.10.638] [ERROR] ReferenceError: window is not defined 0|mm | at /home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:1913 0|mm | at Object.243 (/home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:142305) 0|mm | at e (/home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:151019) 0|mm | at Object.138 (/home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:142720) 0|mm | at e (/home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:151019) 0|mm | at /home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:151060 0|mm | at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-RAIN-MAP/MMM-RAIN-MAP.js:1:151067) 0|mm | at Module._compile (internal/modules/cjs/loader.js:1078:30) 0|mm | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10) 0|mm | at Module.load (internal/modules/cjs/loader.js:935:32)

Configuration: What does the used config.js file look like? Don't forget to remove any sensitive information!
{ module: "MMM-RAIN-MAP", position: "top_right", config: { animationSpeedMs: 1200, defaultZoomLevel: 8, displayTime: true, displayClockSymbol: false, displayTimeline: false, displayOnlyOnRain: true, extraDelayLastFrameMs: 2000, markers: [ { lat: xxx, lng: xxx, color: "grey" } ], mapPositions: [ { lat: xxx, lng: xxx, zoom: 5, loops: 5 }, { lat: xxx, lng: xxx, zoom: 10, loops: 5 } ], mapUrl: "https://tile.jawg.io/e748bbb4-161f-4441-9612-74be9f3b7313/{z}/{x}/{y}.png?access-token=xxxxxx&lang=de&raster=false", mapHeight: "300px", mapWidth: "400px", updateIntervalInSeconds: 300, } },

Additional Notes: Provide any other relevant notes not previously mentioned. This is optional.
Currently the module does not show / hide itself reliably in my case based on precipitation status of MMM-OpenWeatherForecast

@mfehse
Copy link

mfehse commented Aug 29, 2021

same error here.

@jalibu
Copy link
Owner

jalibu commented Aug 29, 2021

@PH1TCH @mfehse
I still can not reproduce that. Can you please provide me your complete config.js?

@mfehse
Copy link

mfehse commented Aug 30, 2021 via email

@jalibu
Copy link
Owner

jalibu commented Aug 30, 2021

Hi @mfehse Michael,
the module works perfectly fine with your config.

Can you please check if you use the latest module version? (by executing git log in the module's directory) It should be the following:

commit 0968c0c90d9223ccc6cb25950052c1d0e3db4a6c
Date:   Sun Aug 29 13:44:10 2021 +0200
Feat/16 frame limits (#17)

If you're already using that version or an update doesn't work, please list all modules that you have installed.

@mfehse
Copy link

mfehse commented Aug 30, 2021 via email

@jalibu
Copy link
Owner

jalibu commented Aug 30, 2021

@mfehse thanks.

The problem comes from MMM-Remote-Control.
It loads and tries to validate frontend Javascript code outside of the Browser context. That causes this issue.

Please open a ticket there. Or safely ignore it.

@ezeholz
Copy link

ezeholz commented Aug 31, 2021

Jopyth/MMM-Remote-Control#267
Thanks for letting me know.

Just to clarify, this issue comes from a bad handling of Javascript files from Remote Control. However, this does not represent a problem because Remote Control just try to load all those files.

You can still use both modules and safely ignore this error. Will be fixed in the next update.

@jalibu jalibu closed this as completed Aug 31, 2021
@mfehse
Copy link

mfehse commented Aug 31, 2021 via email

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

4 participants