ml5js / ml5-library

Friendly machine learning for the web! 🤖

Home Page:https://ml5js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ml5.min.js.map not found if offline

mhechthz opened this issue · comments

To work offline, I downloaded p5.js and ml5.js.

I have following code:

<!DOCTYPE html>
<html>
<head>
    <title>1st script with ml5.js</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../lib/p5.min.js"></script>
    <script src="../lib/ml5.min.js"></script> 
    <!--script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script-->
    
    
    <script>
        console.log('ML5 version:', ml5.version);
    </script>
    
    <script src="code.js"></script>
    
</head>
<body>
</body>
</html>    

In Chrome I get then:

image

So how to get ml5.min.js.map or how to avoid this error?

It looks like you may want to include <meta charset="utf-8" /> to set UTF-8 and prevent the garbled text you're seeing.

A lot of platforms/tools do not run locally for security reasons or system design and the best way around that is to run a lightweight local web server that serves up the application to a local port. One that's built into python is quite nice:

python2:
python -m SimpleHTTPServer $PORT

python3:
python -m http.server $PORT

Remove PORT for default (8000) or change it to the port you want the server on then go to http://localhost:8000/ to view the application.

Thank you @iainnash for the reply! I'm closing the issue for now. Michael -- please feel free to reopen issue if Iain's suggestion doesn't work.