Skip to content

fix: Windows ENOENT by enabling shell resolution for Shopify CLI#47

Open
Xurya wants to merge 1 commit intoShopify:mainfrom
Xurya:bugfix/resolve-shopify-cli-windows
Open

fix: Windows ENOENT by enabling shell resolution for Shopify CLI#47
Xurya wants to merge 1 commit intoShopify:mainfrom
Xurya:bugfix/resolve-shopify-cli-windows

Conversation

@Xurya
Copy link

@Xurya Xurya commented Feb 4, 2026

Summary

  • Adds shell: true on Windows when spawning the Shopify CLI to fix ENOENT failures.
  • Scope-limited to Windows; Linux/macOS behavior remains unchanged.

Problem

  • On Windows, spawn('shopify', ...) can fail with ENOENT even when shopify.cmd exists and where shopify resolves it.
  • Node’s spawn does not resolve .cmd without a shell, causing CLI commands (build/info) to fail under certain PATH/env conditions.

Fix

  • Set shell: true on Windows for the shopify child process as a fallback.

Rationale

  • Minimal, targeted change that unblocks Windows users immediately.
  • Arguments are passed as an array (not a single shell-joined string), reducing typical shell-injection risks.
  • No impact on non-Windows platforms.

Validation

  • Verified on Windows with both global and local CLI installations:
    • ENOENT error resolved; build and info commands succeed under tests.
  • Confirmed no behavior change on non-Windows platforms.

Note

Please test extensively, modify as needed. I've only tested on my local machines and environments (one Windows and one macOS Tahoe v26.0.1)

Potential Improvements / Alternatives

  • Support override (ie SHOPIFY_CLI_PATH to explicitly point at the CLI binary.
  • Prefer local CLI and spawn that absolute path with shell: false. If local CLI not found, use global shopify with shell: true only on Windows.
  • On ENOENT/non-zero exit, include cwd, chosen CLI path, and actionable guidance (e.g., install local CLI or set override).

@Xurya Xurya changed the title fix: Windows ENOENT by enabling shell resolution for Shopify CLI ( fix: Windows ENOENT by enabling shell resolution for Shopify CLI Feb 4, 2026
Enable the shell option when spawning processes on Windows (shell: process.platform === "win32") to ensure resolution of .cmd executables. This prevents failures when invoking tools that rely on Windows command wrappers.
@Xurya Xurya force-pushed the bugfix/resolve-shopify-cli-windows branch from 97768ec to 176d9ac Compare February 4, 2026 16:25
@Xurya
Copy link
Author

Xurya commented Feb 4, 2026

I have signed the CLA!

@lopert lopert mentioned this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant