Fix: Improve Claude binary detection for NVM and production builds#4
Fix: Improve Claude binary detection for NVM and production builds#4joebwd wants to merge 2 commits intowinfunc:mainfrom
Conversation
- Enable 'which' command in production builds (was previously disabled) - Add NVM node versions directory scanning to find Claude installations - Sort NVM versions to check newest first - Remove unnecessary /usr/bin and /bin paths from search - Update error message to include NVM path hint - Fixes issue winfunc#2: Claude binary not found when installed via NVM
- Add NVM path detection to find_claude_binary in mcp.rs - Handle NVM-installed Claude by using node directly to run the script - Ensure Node.js bin directory is added to PATH for NVM installations - Update error messages to include NVM paths This fixes "Failed to load MCP servers" error when Claude is installed via NVM
|
I actually opened a very similar PR, and when started to use it locally, problems showed up: |
|
Awesome - thank you! |
Introduces a dedicated module for detecting Claude Code binary installations with support for multiple sources including NVM, aliased paths, and version-based selection. This shared module improves the reliability of finding Claude installations across different environments. Key features: - Supports multiple installation sources (NVM, system, homebrew, npm, yarn, bun) - Handles aliased paths from 'which' command - Version-aware selection to prefer latest installations - Database caching of discovered binary paths - Comprehensive logging for debugging - Environment variable preservation for NVM compatibility The implementation is inspired by: - #3 - #4
|
Implemented a solution that takes inspiration from this PR and #3. Thank you so much! ❤️ |
|
Building on MacOS still getting: running dev though does find the binary from nvm via I preferred #3 with the dropdown for selecting the version I wanted to use which worked great |
…binary detection This commit provides a comprehensive solution to Claude binary detection issues by implementing a user-friendly version selector UI and improving the binary discovery logic. It addresses all concerns raised in multiple PRs and comments. Changes: - Add ClaudeVersionSelector component for selecting from multiple installations - Update ClaudeBinaryDialog to use version selector instead of manual path input - Fix unused variable warning in production builds (claude.rs:442) - Improve select_best_installation to handle production build restrictions - Add listClaudeInstallations API endpoint to fetch all available installations - Make Claude version indicator clickable to navigate to Settings - Move Claude installation selector to General tab in Settings (per user request) - Enhance dialog UX with loading states and clear installation instructions - Add Radix UI radio-group dependency for version selector Fixes: - Production build warning about unused claude_path variable - Version detection failures in production builds due to process restrictions - Poor UX when Claude binary is not found (now shows helpful dialog) - Inability to easily switch between multiple Claude installations This implementation takes inspiration from: - PR #3: Version selector dropdown approach (preferred by users) - PR #4: Binary detection improvements and path validation - PR #39: Additional detection methods and error handling - Commit 5a29f9a: Shared claude binary detection module architecture Addresses feedback from: - #4 (comment): User preference for dropdown selector - Production build restrictions that prevent version detection - Need for better error handling when Claude is not installed The solution provides a seamless experience whether Claude is installed via: - npm/yarn/bun global installation - nvm-managed Node.js versions - Homebrew on macOS - System-wide installation - Local user installation (~/.local/bin, etc.) Refs: #3, #4, #39, 5a29f9a
Introduces a dedicated module for detecting Claude Code binary installations with support for multiple sources including NVM, aliased paths, and version-based selection. This shared module improves the reliability of finding Claude installations across different environments. Key features: - Supports multiple installation sources (NVM, system, homebrew, npm, yarn, bun) - Handles aliased paths from 'which' command - Version-aware selection to prefer latest installations - Database caching of discovered binary paths - Comprehensive logging for debugging - Environment variable preservation for NVM compatibility The implementation is inspired by: - winfunc/opcode#3 - winfunc/opcode#4
…binary detection This commit provides a comprehensive solution to Claude binary detection issues by implementing a user-friendly version selector UI and improving the binary discovery logic. It addresses all concerns raised in multiple PRs and comments. Changes: - Add ClaudeVersionSelector component for selecting from multiple installations - Update ClaudeBinaryDialog to use version selector instead of manual path input - Fix unused variable warning in production builds (claude.rs:442) - Improve select_best_installation to handle production build restrictions - Add listClaudeInstallations API endpoint to fetch all available installations - Make Claude version indicator clickable to navigate to Settings - Move Claude installation selector to General tab in Settings (per user request) - Enhance dialog UX with loading states and clear installation instructions - Add Radix UI radio-group dependency for version selector Fixes: - Production build warning about unused claude_path variable - Version detection failures in production builds due to process restrictions - Poor UX when Claude binary is not found (now shows helpful dialog) - Inability to easily switch between multiple Claude installations This implementation takes inspiration from: - PR #3: Version selector dropdown approach (preferred by users) - PR #4: Binary detection improvements and path validation - PR #39: Additional detection methods and error handling - Commit 5a29f9a: Shared claude binary detection module architecture Addresses feedback from: - winfunc/opcode#4 (comment): User preference for dropdown selector - Production build restrictions that prevent version detection - Need for better error handling when Claude is not installed The solution provides a seamless experience whether Claude is installed via: - npm/yarn/bun global installation - nvm-managed Node.js versions - Homebrew on macOS - System-wide installation - Local user installation (~/.local/bin, etc.) Refs: #3, #4, #39, 5a29f9a
Summary
Changes
~/.nvm/versions/node/*/bin/directories to find Claude installations managed by NVMTest plan
Related Issues
Fixes #2