abi / screenshot-to-code

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
https://screenshottocode.com
MIT License
60.52k stars 7.43k forks source link

Backend has no output and get " Error generating code. Check the Developer Console AND the backend logs for details." #389

Closed wangzh12023 closed 3 months ago

wangzh12023 commented 3 months ago

Describe the bug I have done the steps according to this mechod to solve problem of portry install , but then when I start the server and upload a picture, it log out the message"Error generating code. Check the Developer Console AND the backend logs for details. Feel free to open a Github issue.", but then I checkout the terminal, there is not any output of error, how can I find the log of error?

Screenshots of backend AND frontend terminal logs backend logs:

(base) (backend-py3.10) PS G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend> mkdir backend # yes, inside backend

    目录: G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2024/8/13     19:46                backend

(base) (backend-py3.10) PS G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend> mv *.py backend/
(base) (backend-py3.10) PS G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend> poetry install
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0)
(base) (backend-py3.10) PS G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend> poetry shell
Virtual environment already activated: C:\Users\33507\AppData\Local\pypoetry\Cache\virtualenvs\backend-xw2tWySF-py3.10
(base) (backend-py3.10) PS G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend> cd backend # yes, backend/backend
(base) (backend-py3.10) PS G:\Wangzh\p2\cs\outfiles\screenshot-to-code\backend\backend> poetry run uvicorn main:app --reload --port 7000
INFO:     Will watch for changes in these directories: ['G:\\Wangzh\\p2\\cs\\outfiles\\screenshot-to-code\\backend\\backend']
INFO:     Uvicorn running on http://127.0.0.1:7000 (Press CTRL+C to quit)
INFO:     Started reloader process [19540] using StatReload
INFO:     Started server process [15308]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

And the screenshot of the frontend: image

abi commented 3 months ago

When you visit http://127.0.0.1:7000 in the browser, what do you see? Is your front-end and back-end running on the same machine?

wangzh12023 commented 3 months ago

When you visit http://127.0.0.1:7000 in the browser, what do you see? Is your front-end and back-end running on the same machine?

I see that: Your backend is running correctly. Please open the front-end URL (default is http://localhost:5173) to use screenshot-to-code.

abi commented 3 months ago

And when you upload an image to the front end, can you share what’s in the browser console and in the backend terminal? I’m unsure why the front end isn’t connecting to the backend.

wangzh12023 commented 3 months ago

And when you upload an image to the front end, can you share what’s in the browser console and in the backend terminal? I’m unsure why the front end isn’t connecting to the backend.

https://github.com/user-attachments/assets/10cde74c-213e-47dd-972c-109ca031c2ba

https://github.com/user-attachments/assets/7eb69e76-d5d9-4ce6-83fc-6839ebb6a73f

abi commented 3 months ago

Seems like your backend is running on :7000 the front-end is trying to connect to :7001

Can you run on 7001 like in the README? poetry run uvicorn main:app --reload --port 7001

That should fix it!

wangzh12023 commented 3 months ago

Seems like your backend is running on :7000 the front-end is trying to connect to :7001

Can you run on 7001 like in the README? poetry run uvicorn main:app --reload --port 7001

That should fix it!

Yes, that resolved. Thanks so much for your help.