Skip to content

fix: resolve Windows npm shim scripts in findClaudeInPath#951

Merged
bra1nDump merged 1 commit intoslopus:mainfrom
LightYear512:fix/windows-shim-resolve
Apr 1, 2026
Merged

fix: resolve Windows npm shim scripts in findClaudeInPath#951
bra1nDump merged 1 commit intoslopus:mainfrom
LightYear512:fix/windows-shim-resolve

Conversation

@LightYear512
Copy link
Copy Markdown
Contributor

Summary

  • Fix findClaudeInPath() failing to spawn Claude on Windows when installed via npm global

Problem

On Windows + nvm, where claude returns 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 at node_modules/@anthropic-ai/claude-code/cli.js adjacent to the shim. Falls back gracefully if not found.

Test plan

  • Verified on Windows 11 + nvm: Claude is correctly detected and spawned
  • No impact on macOS/Linux where shims are not an issue

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.
@bra1nDump bra1nDump merged commit e3d6ff7 into slopus:main Apr 1, 2026
@LightYear512 LightYear512 deleted the fix/windows-shim-resolve branch April 10, 2026 03:47
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.

2 participants