OpenHands/agent-canvas

Windows: `npm run dev` Bad Gateway — Vite exits with `C:\Program` path error

Geschlossen

#715 geöffnet am 21.05.2026

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (26 Forks)github user discovery
buggood first issue

Repository-Metriken

Stars
 (43 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 2T 10h) (106 gemergte PRs in 30 T)

Beschreibung

Bug

On Windows, npm run dev starts the agent-server, automation backend, and ingress proxy successfully, but the UI at http://localhost:8000/ returns Bad Gateway because Vite exits immediately.

[vite] Starting on port 3001...
[vite] 'C:\Program' is not recognized as an internal or external command,
[vite] operable program or batch file.
[vite] Exited with code 1
[ingress] Proxy error for /:

The ingress proxy's default route targets http://localhost:3001. With Vite dead, requests to / fail.

Root Cause

A path under C:\Program Files\... is invoked through a Windows shell without quoting, causing cmd.exe to execute C:\Program instead of the full path.

Workarounds

Bypass the npm wrapper (Vite dev mode):

$env:PYTHONUTF8 = "1"
node --env-file-if-exists=.env .\scripts\dev-with-automation.mjs

Use the static frontend launcher:

$env:PYTHONUTF8 = "1"
node --env-file-if-exists=.env .\scripts\dev-static.mjs
# Skip rebuild after first build:
node --env-file-if-exists=.env .\scripts\dev-static.mjs --skip-build

Fix

In spawnService(), avoid spawning frontend commands through cmd.exe when the command path may contain spaces — either quote the path or set shell: false for Node/npm script invocations on Windows.

This issue was created by an AI agent (OpenHands) on behalf of the user.

Contributor Guide