Fix NVM Node.js PATH issue for locally installed Claude #346
+45
−1
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.
Problem
When opcode is launched from /Applications folder on macOS, it receives a minimal PATH environment that doesn't include NVM directories. This causes Claude commands to fail with "env: node: No such file or directory" for users with npm-local Claude installations that depend on Node.js from NVM.
Root Cause
The existing code had an unused
_std_cmd
variable incommands/claude.rs
that was creating an enhanced PATH but never using it. Additionally, NVM path detection only worked when Claude itself was installed in an NVM directory, not when Claude was elsewhere but needed Node.js from NVM.Solution
This PR provides a minimal, targeted fix:
_std_cmd
so the enhanced PATH is actually usedclaude_binary.rs
to detect and add NVM Node.js paths even when Claude isn't installed via NVMChanges
src-tauri/src/claude_binary.rs
: Added else clause for NVM detection when Claude needs Node but isn't in NVMsrc-tauri/src/commands/claude.rs
: Fixed unused_std_cmd
and added targeted PATH overrideTesting
Impact
Fixes the issue where npm-local Claude installations fail when opcode is launched from /Applications due to missing Node.js in PATH.