-
-
Notifications
You must be signed in to change notification settings - Fork 328
-
Hello,
I install reactpy on Python 3.10.5 and Windows 10.
pip install "reactpy[starlette]"
I run the sample application.
python -c "import reactpy; reactpy.run(reactpy.sample.SampleApp)"
But Chrome shows a blank page and DevTools Console outputs the following:
index.a1f87a11.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
Visual Studio Code TERMINAL outputs the following:
(venv_react) PS D:\dev\python\reactpy\venv_react> python -c "import reactpy; reactpy.run(reactpy.sample.SampleApp)"
2023年06月19日T22:23:33+0900 | WARNING | Therun()function is only intended for testing during development! To run in production, consider selecting a supported backend and importing its associatedconfigure()function fromreactpy.backend.<package>where<package>is one of ['starlette', 'fastapi', 'sanic', 'tornado', 'flask']. For details refer to the docs on how to run each package.
2023年06月19日T22:23:33+0900 | INFO | Running with starlette.applications.Starlette at http://127.0.0.1:8000
INFO: Started server process [31804]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:63690 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:63690 - "GET /index.a1f87a11.js HTTP/1.1" 304 Not Modified
Please let me know what is wrong.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions
I installed reactpy v1.0.1 and followed these steps:
-
I used regedit to navigate to HKEY_CLASSES_ROOT/.js and edited the String Value key.
Name: Content Type
Value: Changed "text/plain" to "application/javascript" -
However, the Chrome DevTools Console still showed an error.
-
I tried using Microsoft Edge instead, and it worked!
Thanks.
Replies: 2 comments 3 replies
-
We've seen this reported by Windows users (accept this discord invite if you haven't already) a number of times. This typically occurs when your mimetype registry has been corrupted (often by VisualStudio). We recently released a patch (v1.0.1) that should work around the corrupted registry. With that said, you should try and fix the registry itself since most other libraries do not attempt to work around the corrupted registry.
If, after upgrading to ReactPy 1.0.1, have fixed your corrupted registry, and are still experiencing issues, try running the page in a private browser (i.e. without extensions). If the page renders, then you may want to try uninstalling extensions, or re-installing your browser.
Beta Was this translation helpful? Give feedback.
All reactions
-
I installed reactpy v1.0.1 and followed these steps:
-
I used regedit to navigate to HKEY_CLASSES_ROOT/.js and edited the String Value key.
Name: Content Type
Value: Changed "text/plain" to "application/javascript" -
However, the Chrome DevTools Console still showed an error.
-
I tried using Microsoft Edge instead, and it worked!
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions
-
I also encountered this problem.
I followed that guide and the problem persisted, either edge or chrome. I am still looking for a solution.
Beta Was this translation helpful? Give feedback.
All reactions
-
My current fix is to use other port number than 8000 as port 8000 does not work.
Something like this, using port 7000 will work.
python -c "import reactpy; reactpy.run(reactpy.sample.SampleApp, port=7000)"
Similar issue is at #1046 (comment)
Beta Was this translation helpful? Give feedback.
All reactions
-
What works for me now without changing ports is remove
Name: Content Type
Value: Changed "text/plain" to "application/javascript"
from .js
Beta Was this translation helpful? Give feedback.