mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #1095] vinext deploy fails on Windows with spawnSync wrangler ENOENT #234
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#234
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @piffie on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/1095
Version observed:
vinext@0.0.47Existing issues searched: None found. Closed #23 was a different Windows issue (ESM URL scheme on
vinext dev, fixed in #31).Symptom
On Windows,
vinext deploy(orvinext deploy --preview) builds the app successfully but fails when invokingwrangler deploy:The
wranglerbinary IS innode_modules/.bin/. The ENOENT is misleading — it means "no executable matched", not "file not found".Root cause
In
dist/deploy.js:On Windows,
node_modules/.bin/contains three files for each binary:wrangler— Unix shebang shell script (cannot be executed by Windows directly)wrangler.CMD— the actual Windows-executable shimwrangler.ps1— PowerShell variantNode's
execFileSync/spawnSyncwithoutshell: trueusesCreateProcess()on Windows, which only resolves.exe,.com,.bat,.cmdextensions via PATHEXT. A bare-name file with no recognised extension fails with ENOENT regardless of whether it exists. Thewrangler(no extension) file is a Unix shebang script — Windows cannot execute it.This is the well-known npm / cross-platform
child_processgotcha. Every PM (npm,yarn,pnpm) and most CLI tools (Vite, Next.js, etc.) handle this either by appending.CMDon Windows or by usingcross-spawn.Reproducer
vinext init, thenvinext deploy --preview.runWranglerDeploythrows ENOENT before invoking wrangler.Workaround
Run the deploy step manually after
vinext build:Suggested fix
Option 1 (smallest): append
.cmdon Windows when constructing the bin pathApply the same logic to any other
execFileSynccall that targets anode_modules/.bin/shim. Thepminstall calls on lines 836 and 956 may have the same issue, sincepmresolves topnpm/npm/yarn/bun— all of which are typically global on Windows so are usually found via PATH and don't hit this bug, but worth auditing.Option 2 (more robust): use
cross-spawncross-spawnis a drop-in replacement that handles Windows shim resolution transparently.Option 3 (least preferred):
{ shell: true }Works but introduces shell-injection surface — args need quoting. Not recommended.
Test coverage suggestion
Closed #23 added a Windows runner to CI for
vinext dev. Extending that runner to also exercisevinext deploy --dry-run(or the underlyingrunWranglerDeploywith a stub wrangler) would catch this regression.Environment
child_processlayer, not the shell)I'm happy to open a PR for Option 1 — would value a steer if maintainers prefer Option 2 (cross-spawn) before I write the patch.