LightRAG icon indicating copy to clipboard operation
LightRAG copied to clipboard

[Question]: <title>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.

Open jvzihaochi opened this issue 9 months ago • 2 comments

Do you need to ask a question?

  • [ ] I have searched the existing question and discussions and this question is not already answered.
  • [ ] I believe this is a legitimate question, not just a bug or feature request.

Your Question

Can anyone tell me why webui is getting an error

Additional Context

jvzihaochi avatar Mar 01 '25 10:03 jvzihaochi

Image

jvzihaochi avatar Mar 01 '25 10:03 jvzihaochi

虽然不清楚为啥会出现这个问题,但是解法如下:修改.venv\Lib\site-packages\lightrag\lightrag.py,476行 class NoCacheStaticFiles(StaticFiles): async def get_response(self, path: str, scope): response = await super().get_response(path, scope) if path.endswith(".js"): response.headers["Content-Type"] = "application/javascript" if path.endswith(".html"): response.headers["Cache-Control"] = ( "no-cache, no-store, must-revalidate" ) response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" return response

添加 if path.endswith(".js"): response.headers["Content-Type"] = "application/javascript"就行了,记得清空浏览器缓存

mengdeer589 avatar May 11 '25 08:05 mengdeer589

Try the latest version pls.

danielaskdd avatar Jul 19 '25 17:07 danielaskdd