Skip to content

fix(cli): resolve spawn EFTYPE on Windows for kimi web and /web - #903

Merged
liruifengv merged 4 commits into
MoonshotAI:mainfrom
ForgottenR:fix/web-daemon-windows-eftype
Jun 24, 2026
Merged

fix(cli): resolve spawn EFTYPE on Windows for kimi web and /web#903
liruifengv merged 4 commits into
MoonshotAI:mainfrom
ForgottenR:fix/web-daemon-windows-eftype

Conversation

@ForgottenR

@ForgottenR ForgottenR commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Related Issue

Resolve #892

Problem

On Windows, spawnDaemonChild tried to execute dist/main.mjs directly. Windows does not honor shebangs and .mjs is not a PE executable, so CreateProcessW returns ERROR_BAD_EXE_FORMAT, which Node reports as spawn EFTYPE.

This only happens when the CLI entry point resolves to the .mjs script. Windows users who installed via the official single-binary install script (PowerShell / Homebrew / SEA) were not affected because their process.execPath is already a native binary.

Affected on Windows

  • npm install -g @moonshot-ai/kimi-code
  • pnpm add -g @moonshot-ai/kimi-code
  • Running from source / development: pnpm dev:cli, node dist/main.mjs, etc.

Not affected on Windows

  • Official PowerShell install script (irm ... | iex)
  • Homebrew install
  • Any installation that uses the single SEA/native binary

What changed

Changed spawnDaemonChild to run the resolved program through process.execPath:

  • If the resolved program is already process.execPath (SEA binary or an already-running daemon child), pass the original args unchanged.
  • Otherwise, prepend the script path as the first argument.

This keeps Unix/macOS behavior unchanged while fixing Windows.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. (Existing spawnDaemonChild test still passes; no new test added.)
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cee184f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ForgottenR

Copy link
Copy Markdown
Contributor Author

@wbxl2000 @sailist Could you take a look at this PR when you have a moment?

@ForgottenR
ForgottenR force-pushed the fix/web-daemon-windows-eftype branch from 9d7ffc1 to f6b6432 Compare June 22, 2026 15:51
@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@cee184f
npx https://pkg.pr.new/@moonshot-ai/kimi-code@cee184f

commit: cee184f

@liruifengv liruifengv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@liruifengv
liruifengv merged commit bbd8a1a into MoonshotAI:main Jun 24, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 24, 2026
@ForgottenR
ForgottenR deleted the fix/web-daemon-windows-eftype branch June 24, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

windows系统上无法使用web ui功能

3 participants