Course map
Stage 1: Foundation
Stage 2: Intermediate
Stage 3: Advanced
Stage 4: Routing and Application Architecture
Stage 5: Specialization (pick ONE)

Part 01 / Topic 8 of 8

Running the dev server and reading the error overlay

Start the dev server with npm run dev and open the URL it prints. While it runs, Vite watches every file you save and pushes the change to the browser - most of the time instantly, without a full page reload (this is Hot Module Replacement, HMR, the reason the dev loop feels instant once the server is up).

When a file cannot even be parsed, Vite does not silently fail: it shows a full-screen overlay in the browser and prints the same error to the terminal that started npm run dev. Breaking examples/02_profile_card.jsx on purpose (deleting its closing </article> tag) while the dev server was running produced this real terminal output:

1:58:19 PM [vite] (client) Pre-transform error: Transform failed with 1 error:

[PARSE_ERROR] Unexpected token. Did you mean `{'}'}` or `&rbrace;`?
    ╭─[ stage-1-foundation/part-01-how-react-runs/examples/02_profile_card.jsx:15:1 ]
    │
 15 │ }
    │ │
    │ ╰─
────╯

  Plugin: vite:oxc
  File: .../02_profile_card.jsx

and the browser's own overlay is built from the same error object the terminal printed - the dev server literally sends a small page whose script does:

const { ErrorOverlay } = await import("/@vite/client")
document.body.appendChild(new ErrorOverlay(error))

where error.message is the exact [PARSE_ERROR] ... text above. The overlay is not a separate, mysterious thing to decode - it is this same compiler error, shown where you are already looking. Saving the file with the </article> tag restored produced one more real, logged line:

1:58:42 PM [vite] (client) hmr update /@fs/.../02_profile_card.jsx

and the page updated without a manual reload. The habit worth building right now: when the overlay appears, read the file name and line number first, not the whole stack - the real bug is almost always exactly where the arrow points, same as the 02_profile_card.jsx:15:1 above, or the "Adjacent JSX elements must be wrapped" / "Expected corresponding JSX closing tag" errors in this part's exercises.

Done here? The practice set for Part 1 — including the solutions — is on the part page.

Search the guide