fix(cli): resolve spawn EFTYPE on Windows for kimi web and /web (#903)
Some checks are pending
CI / build (push) Waiting to run
CI / test (push) Waiting to run
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
Nix Build / Check flake.nix workspace sync (push) Waiting to run
Nix Build / nix build .#kimi-code (push) Blocked by required conditions
Release / Release (push) Waiting to run
Release / Deploy docs (push) Blocked by required conditions
Release / Native release artifact (push) Blocked by required conditions
Release / Publish native release assets (push) Blocked by required conditions

* fix(cli): resolve spawn EFTYPE on Windows for kimi web and /web

* chore(changeset): clarify affected Windows installation methods

---------

Co-authored-by: qer <wbxl2000@outlook.com>
Co-authored-by: liruifengv <liruifeng1024@gmail.com>
This commit is contained in:
ForgottenR 2026-06-24 15:27:00 +08:00 committed by GitHub
parent ea6a4bfe6e
commit bbd8a1a947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Fix `kimi web` and `/web` failing to start the background server daemon on Windows with `spawn EFTYPE` when the CLI is installed via npm/pnpm or run from source. The official single-binary install script was not affected.

View file

@ -204,9 +204,16 @@ export function spawnDaemonChild(options: SpawnDaemonChildOptions): void {
if (options.idleGraceMs !== undefined) {
args.push('--idle-grace-ms', String(options.idleGraceMs));
}
// On Windows `.mjs` files are not executable PE binaries, so we must run
// the script through the Node binary rather than spawning it directly. In
// SEA mode or when re-spawning from an already-running daemon, `program` is
// `process.execPath` itself, so no script argument is needed.
const execPath = process.execPath;
const spawnArgs = program === execPath ? args : [program, ...args];
const logFd = openSync(logPath, 'a');
try {
const child = spawn(program, args, {
const child = spawn(execPath, spawnArgs, {
detached: true,
// Run from the server log directory instead of inheriting the caller's
// cwd, so the long-lived daemon does not pin the directory it was