Project yarn version from Claude Code
I've installed Claude Code using npm install -g @anthropic-ai/claude-code. This works (I can start it with claude), but within Claude Code, Volta appears to change the PATH.
Specifically, if I ask Claude Code to echo $PATH, its value starts with
/Users/me/.volta/tools/image/yarn/4.9.1/bin:/Users/me/.volta/tools/image/node/22.15.0/bin:...
followed by the result that I get when running echo $PATH myself in zsh. I'm guessing the new entries result from the fact that the claude command is itself managed by Volta, due to npm -g.
My issue with this is, whenever claude runs yarn in its internal shell, it gets the global yarn & node versions - even if its working directory is a project that overrides the local yarn version (via package.json "volta" key). Indeed, because yarn 4.9.1 (global version) appears first in claude's PATH, it takes priority over the /Users/me/.volta/bin/yarn shim appearing later in the PATH (which is what I get when running yarn myself in zsh).
Do you think the PATH change is actually due to volta, or a quirk of claude code? If the former, is there a way to override it and let Claude Code use my project's version of yarn?
Possibly related: https://github.com/volta-cli/volta/issues/492
Curiously, the behavior persists even after changing the system version of yarn to match my project (1.22.19) and restarting my terminal: claude code still gets yarn 4.9.1 (the old system version). I am able to get my desired version by reinstalling volta completely and installing 1.22.19 as my first & only yarn version.
Facing this now with PNPM, since upgrading to ClaudeCode to 1.103.0, so seems like they have switch the package manager