OpenHands/agent-canvas

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

Fechada

#715 aberto em 21 de mai. de 2026

 (1 comentário) (0 reação) (0 responsável)TypeScript (26 forks)github user discovery
buggood first issue

Métricas do repositório

Stars
 (43 estrelas)
Métricas de merge de PR
 (Mesclagem média 2d 10h) (106 fundiu PRs em 30d)

Description

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.

Guia do colaborador