OpenHands/agent-canvas

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

クローズ

#715 opened on 2026/05/21

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (26 件のフォーク)github user discovery
buggood first issue

Repository metrics

Stars
 (43 個のスター)
PR merge metrics
 (平均マージ 2d 10h) (30d で 106 merged PRs)

説明

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.

コントリビューターガイド