-
Notifications
You must be signed in to change notification settings - Fork 20
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: glpk is not defined" even after local loading #44
Comments
Hi, here is a minimal example: https://github.com/jvail/glpk.js/blob/master/examples/lp.html If you adjust your import/script then it should work out of the box. |
Thanks for answering! I'm still encountering difficulties using GLPK.js in my local development environment, even after trying different approaches. Here are the issues I'm facing: Approach 1: Local File Import ( import GLPK from '../dist/index.js';) The error in console is: Approach 2: CDN Import ( import GLPK from 'https://cdn.jsdelivr.net/npm/glpk.js@4.0.2/dist/glpk.min.js';) When I try to import GLPK.js as a module from a CDN, I get a different error: The code used is the following: <title>Optimal Transportation Problem with GLPK.js</title> <script type="module"> import GLPK from '../dist/index.js'; (async () => {
Optimal Transportation Problem with GLPK.js |
Yes, that is normal. If you want to develop locally I propose to use serve. That is what I do as well:
|
Hello,
I am facing a problem with GLPK.js. Even after downloading the glpk.min.js file and including it locally in my project, I keep getting the error "Uncaught ReferenceError: glpk is not defined".
My HTML code is as follows:
<script src="glpk.min.js" defer></script> <script> document.addEventListener('DOMContentLoaded', function() { glpk.then(glpk => { // Inicialize o GLPK.js antes de usá-lo console.log("GLPK.js loaded successfully.");<
The text was updated successfully, but these errors were encountered: