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

Uncaught ReferenceError in examples #135

Closed
LimeEric opened this issue Feb 8, 2023 · 4 comments
Closed

Uncaught ReferenceError in examples #135

LimeEric opened this issue Feb 8, 2023 · 4 comments

Comments

@LimeEric
Copy link

LimeEric commented Feb 8, 2023

Description
I tried to run the examples "geo_schelling_points" and "geo_sir". The socket opened but the interface on localhost:8521 did not show anything (only blank screen). The console in the browser showed the following error messages: Uncaught ReferenceError: $ is not defined (at runcontrol.js:101:20) and Uncaught ReferenceError: elements is not defined (at (index):98:1).

I expected it to load up the visualization elements.

I installed Mesa-Geo on Windows in a venv using the two commands:

conda install fiona pyproj rtree shapely
pip install mesa-geo

I downloaded the examples and ran the code using mesa runserver inside the folder.

After I added <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> to the head of modular_template.html of the mesa installation, it worked. However I do not know and do not think, this is the right solution. At least it works for me, for now.
If I missed anything important to reproduce this error or if I just did something the wrong way, I apologize and gladly add further information.

Looking forward to a response. Best regards!

@rht
Copy link
Contributor

rht commented Feb 9, 2023

The jQuery dependency has been removed in projectmesa/mesa@8c30840.
I don't think Mesa-Geo used any of the jQuery syntax either.
Can you track down the content of your runcontrol.js at line 101? Either, it should mean that your Mesa package is outdated.

@LimeEric
Copy link
Author

LimeEric commented Feb 9, 2023

At line 101 of my runcontrol.js is the fpsControl initialization. Is it different from yours?

100  const fpsControl = new Slider("#fps", {
101    max: 20,
102    min: 0,
103    value: controller.fps,
104    ticks: [0, 20],
105    ticks_labels: [0, 20],
106    ticks_position: [0, 100],
107  });
108  fpsControl.on("change", () => controller.updateFPS(fpsControl.getValue()));

@rht
Copy link
Contributor

rht commented Feb 10, 2023

I didn't see any $. Is your Mesa & Mesa-Geo up to date?

@LimeEric
Copy link
Author

Yes, I have Mesa 1.1.1 und Mesa-Geo 0.4.0 installed.
I don't know why the browser console displayed it differently...

I think I found the issue while writing this:
I used to use an older version of Mesa (0.9.0) and the browser probably cached it. After hard refreshing the browser, I did not get the error anymore. Thank you for looking into it!

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