Skip to content

Windows: source build fails (spawnSync npm ENOENT); session migration silently no-ops #151

Description

@Lion-1209

What happened?

作为之前 CLI 的贡献者之一,我发现 Step Code 对 Windows 的兼容性大大提升,已经可以正常使用了,但在本地从源码跑整个项目的时候也踩到两个问题:

  1. pnpm run build 在 coding-agent 打包这一步挂掉。scripts/build-coding-agent-bundle.mjs:181 直接 execFileSync("npm", ...),Windows 上 npm 是 .cmd 批处理,Node 不带 shell 直接 spawn 会 ENOENT。
  2. migrateSessionsFromAgentRoot 在 Windows 上静默失效。packages/config/src/migrations.ts:145file.split("/").pop() 取文件名,Windows 反斜杠路径下拿到的是整条路径,拼出来的目标路径里嵌了盘符,renameSync 在 try/catch 里抛错被吞掉,残留的 *.jsonl 就一直留在 agent 根目录。

补一句:问题 1 昨天的 #137 已经报过、定位一致;问题 2 是我修完问题 1 之后继续跑测试撞到的,那边没提。

环境:Windows 10 原生(非 WSL),Node 24,pnpm 9.15.9,main @ cb5fc14

Steps to reproduce

Windows 原生环境执行 pnpm install --ignore-scripts && pnpm run build。绕过第 1 个问题后,跑 packages/config 的测试能复现第 2 个:migrations.test.ts > relocates stray session files 失败。

Expected behavior

源码构建和 session 迁移在 Windows 原生环境都能正常工作。

Version

0.1.0 (main cb5fc14)

两个问题我本地都已经修好(构建脚本加 shell、取文件名改用 basename),需要的话我可以直接提 PR。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions