Skip to content

fix(upgrade): add shell option on Windows for .cmd package managers#722

Merged
BYK merged 1 commit intomainfrom
fix/windows-spawn-enoent
Apr 13, 2026
Merged

fix(upgrade): add shell option on Windows for .cmd package managers#722
BYK merged 1 commit intomainfrom
fix/windows-spawn-enoent

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 13, 2026

Summary

Fixes CLI-13TUpgradeError: npm failed: spawn npm ENOENT

On Windows, npm/pnpm/yarn are .cmd batch files. child_process.spawn() without shell: true cannot execute .cmd files, causing ENOENT. This affects users who installed the CLI via npm under nvm (or similar Node.js version managers) on Windows.

Changes

  • Add shell: process.platform === "win32" to all three spawn() calls in src/lib/upgrade.ts (runCommand, executeUpgradeHomebrew, executeUpgradePackageManager)
  • Update runCommand JSDoc to document the Windows .cmd issue
  • Update tests in test/isolated/brew-upgrade.test.ts to capture and assert the shell spawn option

No behavior change on Linux/macOS — the condition evaluates to false (the existing default).

…LI-13T)

On Windows, npm/pnpm/yarn are .cmd batch files. child_process.spawn()
without shell: true cannot execute .cmd files, causing ENOENT.

Add shell: process.platform === "win32" to all spawn() calls in
upgrade.ts so cmd.exe resolves .cmd wrappers correctly. This fixes
both upgrade execution and legacy installation method detection on
Windows (including nvm-managed Node.js).
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (init) Remove JSON minification that breaks edit-based codemods by betegon in #719
  • (issue) Support share issue URLs by BYK in #718
  • (upgrade) Add shell option on Windows for .cmd package managers by BYK in #722

Internal Changes 🔧

  • Regenerate skill files by github-actions[bot] in ca16b2ff

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-722/

Built to branch gh-pages at 2026-04-13 11:02 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1596 uncovered lines.
✅ Project coverage is 95.31%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.30%    95.31%    +0.01%
==========================================
  Files          232       232         —
  Lines        34035     34041        +6
  Branches         0         0         —
==========================================
+ Hits         32436     32445        +9
- Misses        1599      1596        -3
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review April 13, 2026 11:19
@BYK BYK merged commit 29b8eba into main Apr 13, 2026
24 checks passed
@BYK BYK deleted the fix/windows-spawn-enoent branch April 13, 2026 11:41
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