Fix: Tool Execution Failed (Exit Code 127)
Error Message:
"Tool execution failed with exit code 127" "/bin/sh: python: command not found" "npm: command not found"
The Cause
Claude Cowork runs commands in a non-interactive shell. It does NOT load your full .zshrc or .bash_profile. This means custom aliases, PATH modifications, or tools installed via brew might be invisible to Claude.
The Fix
1. Use Absolute Paths
Tell Claude to find the tool first.
"Run
which python3to find the path, then use the full path (e.g.,/usr/local/bin/python3) for the command."
2. Prefix with PATH
You can pass the PATH variable explicitly in the command.
"Run
export PATH=$PATH:/opt/homebrew/bin && npm install"
3. Check Node/Python Versions
If node works but is the wrong version:
Claude might be using the system Node (v12) instead of your NVM Node (v20).
"Do not assume NVM is loaded. Use
node -vto check the version first."
Prevention
- Config: You can configure a
.envfile in your Cowork project settings to set thePATHvariable permanently for that session.