fix: resolve Windows npm shim scripts in findClaudeInPath#951
Merged
bra1nDump merged 1 commit intoslopus:mainfrom Apr 1, 2026
Merged
fix: resolve Windows npm shim scripts in findClaudeInPath#951bra1nDump merged 1 commit intoslopus:mainfrom
bra1nDump merged 1 commit intoslopus:mainfrom
Conversation
On Windows + nvm, `where claude` finds a shell script shim that cannot be spawned directly by Node.js. Detect non-executable shims and resolve to the actual cli.js in the adjacent node_modules directory instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
findClaudeInPath()failing to spawn Claude on Windows when installed via npm globalProblem
On Windows + nvm,
where claudereturns a shell script shim (no file extension) created by npm for global packages. Node.js cannot spawn these shims directly, causing Claude detection to fail silently.Solution
When the resolved path is not a recognized executable (
.js,.cjs,.exe), treat it as an npm shim and look for the actual entry point atnode_modules/@anthropic-ai/claude-code/cli.jsadjacent to the shim. Falls back gracefully if not found.Test plan