Skip to content

fix(windows): probe native-install paths in Find-ClaudeExe - #4

Merged
ron2k1 merged 1 commit into
mainfrom
fix/win-resolver-native-install
Jun 11, 2026
Merged

ron2k1 merged 1 commit into
mainfrom
fix/win-resolver-native-install

Conversation

@ron2k1

@ron2k1 ron2k1 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Why

Two consecutive claude launches on 2026-06-11 failed with claude not found in PATH or common install locations because an npm update of @anthropic-ai/claude-code was mid-reinstall: npm deletes the bin shims (claude / claude.cmd / claude.ps1) before recreating them, so Find-ClaudeExe legitimately found nothing during that window.

Diagnosing it exposed a worse latent gap: the Windows resolver only knew npm-era locations (4 candidates), while the POSIX find-claude.sh resolvers carry 9 probes including native installs. Migrating off npm (claude.exe at ~\.local\bin or ~\.claude\local) would have bricked the wrapper permanently, not transiently.

What

  • Add the two native-installer candidates ahead of the npm shims in Find-ClaudeExe — a real PE binary needs no cmd.exe host-routing, so it is strictly preferable when present.
  • Teach the not-found error message about the transient mid-update shim window.

Verification

  • All 4 Windows suites pass: job-object kill-on-close (7ms reap), orphan-detect, config-loader, spawn-plan.
  • End-to-end: claude --version → 2.1.173 (Claude Code) through the PS 5.1 -ShadowClaude profile function with this change live.

🤖 Generated with Claude Code

Observed 2026-06-11: two consecutive `claude` launches failed with
"claude not found" because an npm update of @anthropic-ai/claude-code
was mid-reinstall -- npm deletes the bin shims (claude/.cmd/.ps1)
before recreating them (shims re-stamped 13:53:17), so the resolver's
PATH probe and npm candidates both legitimately missed.

The surprise: the Windows resolver only knew npm-era locations, while
the POSIX find-claude.sh resolvers carry 9 probes including native
installs. A migration off npm (claude.exe at ~\.local\bin or
~\.claude\local) would have bricked the wrapper permanently, not
transiently. Added both native-install candidates ahead of the npm
shims (real PE binary needs no cmd.exe host-routing) and taught the
error message about the transient mid-update window.

Tests: all 4 Windows suites pass (job-object kill-on-close 7ms,
orphan-detect, config-loader, spawn-plan); end-to-end `claude
--version` green under PS 5.1 profile wrapper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ron2k1
ron2k1 merged commit fd8d0ec into main Jun 11, 2026
3 checks passed
@ron2k1
ron2k1 deleted the fix/win-resolver-native-install branch June 11, 2026 18:16
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