Skip to content
>_VibeUnstuck

Failed to start dev server in Bolt

Last verified:

The fix

Failed to start dev server in Bolt means the Vite preview crashed before paint. Read the first red line in the terminal, fix that error, and restart.

  1. 1

    Read the first terminal error

    Open Bolt’s terminal, not only the preview. The first error during install or Vite startup is the one to fix. “Failed to start dev server” at the bottom is the summary.

  2. 2

    Then read the browser console

    If the terminal says the server is running and the preview is white, the crash is in the page. The console names the file. Fix that exception before you regenerate the project.

  3. 3

    Keep Node-only code out of the client

    Do not import fs, path, or a secret-bearing SDK into a component. Call a server you control, or delete the import. A Bolt project does not grow a backend on another port unless you configure one, and the preview will not proxy it for you by default.

  4. 4

    Fix install failures in package.json

    If install stopped on ERESOLVE, change the version so it matches the React version already in the project. Do not keep clicking a fix button that rewrites the lockfile. See the npm ERESOLVE page.

Why it happens

Bolt runs the frontend in a WebContainer and shows that dev server in the preview. If npm install failed, the dev script is not vite, or Vite crashed on a syntax error, the preview has nothing to load.

A white screen after “compiled” is a runtime error in the browser. The usual AI mistake is importing fs, a secret SDK, or process.env without the VITE_ prefix into a client file. Those throw in the browser (process is not defined, or a missing module) and React never paints.

The next error you'll probably hit

Once this is fixed, the usual follow-up is We couldn't find a web server. We couldn't find a web server. Replit only forwards a process listening on 0.0.0.0 and the localPort in .replit. localhost and 127.0.0.1 stay inside the sandbox, including on a published app.

Prompt to paste back into your AI tool

Paste this above the error.

The Bolt preview is blank. Here is the first error from the terminal or the browser console:
<paste the first error>

Do not regenerate the whole project. Do not import fs or a secret SDK into a client file.

1. If install failed, fix the dependency version. Do not use --legacy-peer-deps unless you explain the peer conflict.
2. If Vite crashed, fix that syntax or import error only.
3. If the console says process is not defined or the module is Node-only, remove it from the client.
4. Leave the rest of the files alone.

Common questions

+The preview was fine and went white after one edit. Why?

That edit threw at runtime or broke the dev server. Check the console and the terminal for the file from the last edit. Restore that file from history if the change was a drive-by rewrite.

+Can Bolt preview a second server on another port?

Not unless you configure it. The preview follows the frontend dev server. A backend you start on another port is invisible until something proxies to it.

Related errors