mathjax / MathJax-node

MathJax for Node
Apache License 2.0
614 stars 96 forks source link

File load err: file://svg/jax.js error thrown at times #422

Closed einsteinreloaded closed 6 years ago

einsteinreloaded commented 6 years ago

image

dpvc commented 6 years ago

The error message is not enough to give you any help. Can you provide a minimal example code that illustrates the problem you are having?

One possibility is that you don't have mathjax installed properly. Did you check that the files like file:///app/node_modules/mathjax/unpacked/jax/output/SVG.jax.js actually exist? Is the path correct? (I.e., are you working in the top-level directory called app?)

einsteinreloaded commented 6 years ago

This is occurring once in a while not always. I am using mathjax node package and serving it as an api to my website.

dpvc commented 6 years ago

This is occurring once in a while not always.

I understand that, but without a code sample to work with, there is nothing we can do to help. We have no idea what your setup is, how you are calling mathjax-node, or what sort of timing issues might be causing the problem intermittently.

The fact that it is not always occurring suggests that there is a race condition somewhere in your app (so that sometimes something is not set up in time for mathjax-node to load its files properly). Those are notoriously difficulty to diagnose. Certainly we have no hope if doing so without knowing the details of how your app works.

I'm sorry, but there isn't much else we can do at this point.

einsteinreloaded commented 6 years ago
router.post '/equationhtml', (req, res)->
    try 
        mathjax.start();
        yourMath = req.body.eqntex
        mathjax.typeset({ 
                math: yourMath,
                format: "inline-TeX", 
                html: true
            },
            (data) -> 
                res.send data
        );
    catch err
        winston.info(err)

I am using this code in my router file. i have tried putting them inside try and catch as you can see but still the error doesn't get caught in this try catch. I am using coffeescript

dpvc commented 6 years ago

Try removing the mathjax.start() call. It is not needed, and causes MathJax to be reloaded for every request. That means it has to load all its files again, which seems to be where you are running into troubles.

einsteinreloaded commented 6 years ago

@dpvc I missed out on that. Thank you I will implement this fix. Closing this issue and will reopen if still exists