Lesson: Claude CLI PATH Issues on Windows PowerShell
Date: 2026-05-01
Context: Attempting to run claude from PowerShell after installing OBSIDIAN
Status: ⚠️ UNRESOLVED — handed to new chat session for fix
What Happened
Claude Code 2.1.119 was confirmed installed via claude --version from Desktop
Commander’s PowerShell process, but Damien’s open PowerShell terminal returned
“command not found” / “‘claude.exe’ is not recognized”.
Debugging Steps Taken
| Step | Finding |
|---|---|
where.exe claude | Found at C:\Users\DamienGoBeyond\AppData\Roaming\npm\claude.cmd and C:\Users\DamienGoBeyond\.local\bin\claude.cmd |
| Check PATH | Both npm and .local\bin were in system PATH |
| Full path call | & 'C:\Users\DamienGoBeyond\AppData\Roaming\npm\claude.cmd' --version returned 2.1.119 correctly |
| Root cause (phase 1) | Terminal was opened before PATH was set — stale session |
| Fix attempt | Wrote PowerShell profile to add npm to PATH on load |
| New problem | Profile stored in Cloudflare R2 — treated as remote/unsigned by PowerShell |
| Fix | Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force |
Unblock-File on profile | Run — confirmed IsBlocked = False |
Profile loaded (. $PROFILE) | Succeeded — no error |
claude --version after profile | Still failed: “The system cannot find the path specified. ‘claude.exe’ is not recognized” |
| Likely root cause | claude.cmd invokes claude.exe via a path that doesn’t exist, or the cmd/bat context inside .cmd files doesn’t inherit the same PATH as PowerShell |
What We Know
- The
.cmdfile exists and is reachable - Running it with a full path works from Desktop Commander’s shell but not from the user’s PowerShell
- The error message references
claude.exe— the.cmdwrapper likely calls an.exevia a relative or baked-in path - The npm global install may have placed binaries expecting a different Node/npm layout
Suspected Fix Directions (for next session)
- Check what’s inside
claude.cmd— does it reference a path that doesn’t exist? - Check if
claude.exeactually exists anywhere on the system - Try
npx @anthropic-ai/claude-codeas an alternative invocation - Reinstall Claude Code:
npm install -g @anthropic-ai/claude-code - Check Node.js version compatibility
See Also
- 2026-05-01-decision-implement-OBSIDIAN — Why we need Claude CLI working
- lessons — Related troubleshooting lessons