MoonshotAI / MoonshotAI/kimi-code

dev:server and dev:kap-server scripts fail on Windows (inline env-var prefix in npm script)

Open Beginner friendly
#3,413 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Environment

  • OS: Windows 11 (pnpm runs scripts via cmd.exe)
  • pnpm 10.33.0, Node.js 26.7.0
  • kimi-code 0.39.1 (also main @ 19413c280)

What happens

> pnpm dev:server
'KIMI_CODE_DEV_SERVER' is not recognized as an internal or external command,
operable program or batch file.
 ELIFECYCLE  Command failed with exit code 1.

Root cause

apps/kimi-code/package.json uses a POSIX-style inline environment prefix:

"dev:server": "KIMI_CODE_DEV_SERVER=1 tsx --tsconfig ./tsconfig.dev.json --import ../../build/register-raw-text-loader.mjs ./src/main.ts web --no-open --debug-endpoints"

On Windows, pnpm/npm execute scripts through cmd.exe, which does not support the
VAR=value command form. POSIX shells handle it, so Linux/macOS (and CI) are
unaffected. dev:kap-server and dev:kap-server:multi share the same problem;
dev/dev:cli work because they call node scripts/dev.mjs with no env prefix.

Workaround (verified on Windows 11)

Run the underlying command from Git Bash, where env prefixes work natively:

KIMI_CODE_DEV_SERVER=1 pnpm exec tsx --tsconfig ./tsconfig.dev.json \
  --import ../../build/register-raw-text-loader.mjs ./src/main.ts web --no-open --port 58630

Suggested fix

Move the env assignment into a Node wrapper (the existing scripts/dev.mjs
pattern) or use cross-env. Happy to open a PR once a maintainer indicates the
preferred approach.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/kimi-code/package.json and compare dev:server, dev:kap-server, and dev:kap-server:multi with the existing scripts/dev.mjs pattern. Choose the project's preferred cross-platform approach, then verify the affected commands work under Windows cmd.exe while preserving their existing server arguments and POSIX behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.