ddPn08 / Radiata

Stable diffusion webui based on diffusers.
https://ddpn08.github.io/Radiata/
Apache License 2.0
984 stars 68 forks source link

White screen error continued #27

Closed Seantourage closed 1 year ago

Seantourage commented 1 year ago

Windows 11 node.js (recommended version is 18) pnpm python 3.10 pip CUDA cuDNN < 8.6.0 TensorRT 8.5.x

When loading the app at http://localhost:3000/app/ get a white page

HTML source

<html>
<body>
<!--StartFragment-->

<!DOCTYPE html>
--
  | <html lang="en">
  | <head>
  | <meta charset="UTF-8" />
  | <link rel="shortcut icon" type="image/ico" href="/app/assets/icon-x512-70179e20.png" />
  | <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  | <title>Lsmith</title>
  | <script type="module" crossorigin src="/app/assets/index-de1c5979.js"></script>
  | </head>
  | <body>
  | <noscript>You need to enable JavaScript to run this app.</noscript>
  | <div id="root"></div>
  |  
  | </body>
  | </html>

<!--EndFragment-->
</body>
</html>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="shortcut icon" type="image/ico" href="[/app/assets/icon-x512-70179e20.png](http://localhost:3000/app/assets/icon-x512-70179e20.png)" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Lsmith</title>
    <script type="module" crossorigin src="[/app/assets/index-de1c5979.js](http://localhost:3000/app/assets/index-de1c5979.js)"></script>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>

  </body>
</html>

Web Console:

index-de1c5979.js:48 

       TypeError: Cannot read properties of null (reading 'useState')
    at ue.useState (index-de1c5979.js:9:6382)
    at WU (index-de1c5979.js:82:23190)
    at Ey (index-de1c5979.js:46:19518)
    at DO (index-de1c5979.js:48:43960)
    at RO (index-de1c5979.js:48:39724)
    at PN (index-de1c5979.js:48:39652)
    at kc (index-de1c5979.js:48:39506)
    at Rv (index-de1c5979.js:48:35874)
    at NO (index-de1c5979.js:48:34825)
    at $ (index-de1c5979.js:33:1550)
Sv @ index-de1c5979.js:48
index-de1c5979.js:48 

       Uncaught TypeError: Cannot read properties of null (reading 'useState')
    at ue.useState (index-de1c5979.js:9:6382)
    at WU (index-de1c5979.js:82:23190)
    at Ey (index-de1c5979.js:46:19518)
    at DO (index-de1c5979.js:48:43960)
    at RO (index-de1c5979.js:48:39724)
    at PN (index-de1c5979.js:48:39652)
    at kc (index-de1c5979.js:48:39506)
    at Rv (index-de1c5979.js:48:35874)
    at NO (index-de1c5979.js:48:34825)
    at $ (index-de1c5979.js:33:1550)

App Console:

venv "C:\AI\Lsmith\venv\Scripts\Python.exe"
Installing requirements
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 360ms

> Lsmith@0.0.0 build C:\AI\Lsmith\frontend
> tsc && vite build "--out-dir" "C:\\AI\\Lsmith\\dist"

vite v4.1.1 building for production...
✓ 4345 modules transformed.
../dist/index.html                       0.50 kB
../dist/assets/icon-x512-70179e20.png   19.92 kB
../dist/assets/index-de1c5979.js       566.60 kB │ gzip: 170.99 kB

(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
INFO:     Started server process [3404]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit)
INFO:     127.0.0.1:51299 - "GET / HTTP/1.1" 307 Temporary Redirect
INFO:     127.0.0.1:51299 - "GET /app HTTP/1.1" 307 Temporary Redirect
INFO:     127.0.0.1:51299 - "GET /app/ HTTP/1.1" 200 OK
INFO:     127.0.0.1:51299 - "GET /app/assets/index-de1c5979.js HTTP/1.1" 200 OK
INFO:     127.0.0.1:51417 - "GET / HTTP/1.1" 307 Temporary Redirect
INFO:     127.0.0.1:51417 - "GET /app HTTP/1.1" 307 Temporary Redirect
INFO:     127.0.0.1:51417 - "GET /app/ HTTP/1.1" 200 OK
INFO:     127.0.0.1:51417 - "GET /app/assets/index-de1c5979.js HTTP/1.1" 200 OK
INFO:     127.0.0.1:51459 - "GET /app/ HTTP/1.1" 200 OK
Norod commented 1 year ago

I also get a white page, same setup However in my web console I see:

Loading failed for the module with source “http://localhost:3000/app/assets/index-d63ed595.js”. [app:8:1](http://localhost:3000/app/)
Loading module from “http://localhost:3000/app/assets/index-d63ed595.js” was blocked because of a disallowed MIME type (“text/plain”).
fkunn1326 commented 1 year ago

https://twitter.com/Ai_tensa/status/1624291558446211072

Norod commented 1 year ago

Can confirm @fkunn1326 solution fixed it


diff --git a/modules/main.py b/modules/main.py
index bafa4c1..4542d5b 100644
--- a/modules/main.py
+++ b/modules/main.py
@@ -11,6 +11,10 @@ from . import config, runners
 from .api.api_router import api
 from .frontend import frontend
 from .shared import ROOT_DIR
+import mimetypes
+
+mimetypes.init()
+mimetypes.add_type("application/javascript", ".js")

 def custom_generate_unique_id(route: APIRoute):
fkunn1326 commented 1 year ago

This bug fixed in https://github.com/ddPn08/Lsmith/commit/59fbd01f014b5711a18a276c0a423057463d7379