Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"

オープン 初心者向け
#792 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Caldas がすでに取り組んでいます。

2026年10月14日 から。

  • #793 @Caldas による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nodejs, typescript
領域
backend, cli

調査の方向性

server/src/learning/ensure-container.ts の runCli(124〜149行目付近)から始めてください。Windows では shell を指定せずに spawn が呼ばれています。scripts/setup-learning.ts からのエントリポイントもたどってください。Windows で bun scripts/setup-learning.ts を実行して EINVAL を再現し、child.on("error") のハンドラが迂回されていないか確認してください。セットアップスクリプトが Windows で動作し、CLI コマンドが成功すれば完了です。macOS と Linux の動作は変わらないことが条件です。

索引モデルが issue の本文から書いたものです。

説明

On Windows, bun scripts/setup-learning.ts (Quick start, step 2) stops before doing anything, and prints only this:

PS C:\...\openbot> bun scripts/setup-learning.ts
spawn npx.cmd EINVAL

npx --yes copilotkit@latest login and project select had both succeeded beforehand, from the OpenBot root. Nothing is written to .env, so neither the runtime key nor the openbot Learning container is set up.

Cause

runCli in server/src/learning/ensure-container.ts:124-149 starts the CopilotKit CLI like this:

const child = spawn(
  process.platform === "win32" ? "npx.cmd" : "npx",
  ["--yes", "copilotkit@latest", ...args],
  { cwd: directory, env: cliEnvironment(), stdio: ["ignore", "pipe", "pipe"] },
);

Since the fix for CVE-2024-27980, Node refuses to spawn a .cmd or .bat file without shell: true, and Bun does the same. The refusal is a synchronous EINVAL thrown by spawn() itself, not an 'error' event. As a result, the child.on("error", () => finish(127)) handler at line 147 never runs. The throw happens inside the Promise executor, so it becomes a rejection, and setup-learning.ts exits with the bare message.

Minimal reproduction, Bun 1.4.3 on Windows 11:

import { spawn } from "node:child_process";
spawn("npx.cmd", ["--version"]);                 // throws: spawn npx.cmd EINVAL
spawn("npx.cmd", ["--version"], { shell: true }); // runs, prints 11.19.0

The server calls the same runCli from ensureLearningContainer at boot (server/src/index.ts:360) when a CLI login is present. Automatic container creation should therefore fail the same way on Windows, although I have only reproduced it through the setup helper.

Suggested fix

Run through the shell on Windows only:

{
  cwd: directory,
  env: cliEnvironment(),
  shell: process.platform === "win32",
  stdio: ["ignore", "pipe", "pipe"],
}

With shell: true the arguments are joined into a cmd.exe command line rather than passed as an argv. That is safe here because every caller passes literals (whoami, project list --json). cliEnvironment() already keeps COMSPEC, SystemRoot and PATHEXT, so cmd.exe resolves. macOS and Linux are unchanged.

Windows 11 Enterprise 10.0.26200, Bun 1.4.3, Node 24.21.0 / npm 11.19.0, OpenBot at 8c9ad4c. Related: #679 and #681 (other Windows checkout problems).

主要言語
TypeScript
スター
6.3k
フォーク
863
平均マージ
17時間 38分
マージ済み PR(30日)
161

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CopilotKit/OpenBot のほかの issue

CopilotKit/OpenBot の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。