Demo, all content is generated
Question

ChatGPT says my code is correct but it doesn't work, what do I send it?

Solved · 611 views · asked by wairimu · edited

Beginner here. When my page doesn't work I tell ChatGPT "it doesn't work" and it says the code looks correct and suggests things that don't help. I don't know what information it needs. Where do I even find the error?

What I’ve tried

Pasted the whole component again, and described what I expected to happen.

Comment
Do you see anything red in the browser console when it fails? bytebarista · edited
I don't know where that is, sorry. wairimu · edited

3 answers

Marked as helpful by the asker
bytebarista · edited

"It doesn't work" gives it nothing to go on. It needs the error message. Where to find it:

  1. Browser: right-click > Inspect > Console tab. Red lines are errors.
  2. Network tab, if data doesn't load: click the red request, check the status (404, 500) and the Response.
  3. Terminal where npm run dev runs: server errors land there, not in the browser.

Then send it:

Expected: clicking Save adds the task to the list. Actual: nothing happens. Console error: (paste exact text) Relevant code: (only the component involved)

That template alone will change the quality of answers a lot.

Comment
I never opened the console before. There was a red error the whole time. Fixed in 5 minutes with this. wairimu · edited
Saving the template, thanks. the_real_omar · edited
wes_codes · edited

Also add console.log in the function you think runs. If the log doesn't show up, the problem is before that function, which halves the search.

Comment
marco_py · edited

Read error messages from the top line; the rest (the stack trace) shows where it happened. Find the first line that mentions one of your files, that's usually where to look.

Comment