You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: cf build / dev / deploy fail with spawn EFTYPE when delegating to Wrangler #19
cf migrate and the API commands work fine. Only the Wrangler delegate path is affected.
Environment
Windows 11 (10.0.22631)
Node.js v24.13.0
cf 1.0.0-beta.5 (global install)
wrangler 4.143.0 (local devDependency)
Same result in PowerShell 7 and Git Bash
Same result with the default bundler and with cf migrate --bundler vite
Steps to reproduce
Take a plain JS Worker with a wrangler.toml (no Vite plugin).
npm i -D wrangler@latest
cf migrate
cf build
Cause
discover-*.mjs resolves the delegate binary as <pkgRoot>/bin/cf-wrangler.js (binary: a("cf-wrangler.js")) and it is then passed straight to child_process.spawn. Windows cannot execute a .js file directly (no shebang support), so Node throws EFTYPE.
Spawning through process.execPath starts the script normally.
Suggested fix
When the resolved binary ends in .js/.mjs/.cjs, spawn process.execPath with the script path as the first argument, rather than spawning the script itself. That works on every platform, so no Windows-specific branch is needed. The same resolver is used for the other npm delegates (for example cf-vite), so they may be affected too.
The existing spawn(command, [...prefixArgs, verb, ...argv], options) call remains unchanged. On Windows, npm delegates are launched through the same Node executable as cf, without enabling shell execution. Other platforms and non-npm delegates retain their existing behavior.
Applying the workaround to the published package
We patched the compiled file, not the TypeScript source:
The compiled filename and replacement above are specific to cf 1.0.0-beta.5. Commit the generated patch, pnpm patch configuration, and lockfile so subsequent installs retain the workaround.
Verification
After applying the patch, the Wrangler-backed build completed successfully:
├ Build
│ Delegating to Wrangler
◆ Build complete
A separate subprocess check also verified a delegate path containing spaces, arguments containing spaces and a literal &, and propagation of a non-zero exit code.
This is a temporary workaround. We have confirmed the Wrangler build path; we have not yet verified cf dev, cloud deployment, or the Vite delegate with this patch.
Activity
Kanayan-KK commentedon Sep 29, 2026
Confirmed with cf 1.0.0-beta.5, Wrangler 4.143.0, and Node.js 24.21.0 on Windows using PowerShell.
We worked around this using a local pnpm patch. The equivalent source change in
packages/cli/src/commands/dev/spawn.ts, insidespawnImpl(), is:The existing
spawn(command, [...prefixArgs, verb, ...argv], options)call remains unchanged. On Windows, npm delegates are launched through the same Node executable as cf, without enabling shell execution. Other platforms and non-npm delegates retain their existing behavior.Applying the workaround to the published package
We patched the compiled file, not the TypeScript source:
Run:
In the directory printed by pnpm, open
dist/spawn-IM_tQldH.mjsand replace this exact fragment:with:
Save the file and apply the patch:
pnpm patch-commit "<directory printed by pnpm>"Retry:
pnpm exec cf build --mode stagingThe compiled filename and replacement above are specific to cf 1.0.0-beta.5. Commit the generated patch, pnpm patch configuration, and lockfile so subsequent installs retain the workaround.
Verification
After applying the patch, the Wrangler-backed build completed successfully:
A separate subprocess check also verified a delegate path containing spaces, arguments containing spaces and a literal
&, and propagation of a non-zero exit code.This is a temporary workaround. We have confirmed the Wrangler build path; we have not yet verified
cf dev, cloud deployment, or the Vite delegate with this patch.fix: run Node dev-server delegates through Node on Windows