Windows: spawn ENOENT in app-server.mjs — missing shell:true for .cmd shims

Open 💬 1 comment Opened Mar 31, 2026 by paulmsantiago

Bug

On Windows, codex-companion.mjs adversarial-review fails with spawn codex ENOENT even though codex is installed and in PATH (via npm global).

Root cause

app-server.mjs line 188 uses spawn("codex", ["app-server"]) without shell: true. On Windows, Node.js spawn without shell: true cannot resolve .cmd shims — it needs a native binary.

Meanwhile, process.mjs:runCommand() correctly uses shell: process.platform === "win32", so the binaryAvailable("codex") check passes (finding codex.cmd via shell), but the actual spawn fails.

Fix

Add shell: process.platform === "win32" to the spawn options in app-server.mjs:

\\\js
this.proc = spawn("codex", ["app-server"], {
cwd: this.cwd,
env: this.options.env,
stdio: ["pipe", "pipe", "pipe"],
shell: process.platform === "win32" // <-- add this
});
\
\\

This matches the pattern already used in process.mjs.

Environment

  • OS: Windows 11 (10.0.26200)
  • Node: v22.x
  • codex-cli: 0.117.0 (npm global install)
  • Claude Code plugin: codex@openai-codex 1.0.1

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗