Error: Install claude code first
Improve error message for Claude Code detection when using aliases
Problem Description
When using the Claude Code Chat extension in VSCode, users may encounter the error "ERROR: Install claude code first" even when Claude Code is properly installed and functioning correctly in their terminal.
Root Cause
This issue occurs when Claude Code is accessible via shell aliases but not directly in the system PATH. The extension appears to check for the claude command using direct PATH lookup rather than shell alias resolution.
In my case:
- Claude Code was installed and working perfectly in terminal
which claudeshowed:claude: aliased to /Users/zxd/.claude/local/claude- The extension couldn't detect the installation due to the alias
Current User Experience
- User installs Claude Code successfully
- Claude works fine in terminal via alias
- VSCode extension shows "ERROR: Install claude code first"
- User is confused because Claude Code is clearly installed and working
Suggested Improvements
1. Enhance Detection Logic
- Check both PATH and common shell aliases for
claudecommand - Look for Claude Code in common installation directories
- Provide a setting to manually specify the Claude executable path
2. Improve Error Message
Current: ERROR: Install claude code first
Suggested:
ERROR: Claude Code not found
The extension couldn't locate the Claude Code executable. This might happen if:
• Claude Code is not installed
• Claude Code is accessible via alias but not in PATH
• Claude Code is installed in a non-standard location
Solutions:
• Install Claude Code: npm install -g @anthropic-ai/claude-code
• Add Claude to PATH or create a symlink: sudo ln -s /path/to/claude /usr/local/bin/claude
• Configure custom path in extension settings
3. Add Configuration Option
Add a setting like claudeCodeChat.executablePath to allow users to specify the exact path to their Claude installation.
Steps to Reproduce
- Install Claude Code in a custom location (e.g.,
/Users/username/.claude/local/claude) - Create an alias in shell:
alias claude='/Users/username/.claude/local/claude' - Verify Claude works in terminal:
claude --version - Open VSCode and try to use Claude Code Chat extension
- Observe the "Install claude code first" error
Environment
- OS: macOS
- VSCode Version: [your version]
- Extension Version: [extension version]
- Claude Code Installation: Custom path with alias
Workaround
Create a symlink to make Claude available in PATH:
sudo ln -s /Users/zxd/.claude/local/claude /usr/local/bin/claude
Or add the Claude directory to PATH in shell configuration.
Same error
Workaround
- Clone project
- edit extension.ts:535
console.log('Using native Claude command');
claudeProcess = cp.spawn('claude', args, {
shell: true,
cwd: cwd,
stdio: ['pipe', 'pipe', 'pipe'],
env: {
...process.env,
PATH: process.env.PATH + ':/home/main/.local/share/pnpm',
FORCE_COLOR: '0',
NO_COLOR: '1'
}
});
- compile
- install extension from compiled .vsix
Environment
OS: Linux (6.15.9-arch1-1) VSCode Version: 1.103.1 Extension Version: 1.0.3 Claude Code Installation: /home/main/.local/share/pnpm/claude
+1
I ran into the same problem on **Linux (Pop!_OS in my case)** and found the fix.
The issue was that when starting VS Code from the application launcher
(icon), it doesn't load the shell's environment variables like
~/.bashrc or ~/.zshrc. That's why claude worked in my terminal but
not inside VS Code.
Solution
Add the NVM bin path to your ~/.profile so that GUI apps
(including VS Code) can see it:
export PATH="$HOME/.nvm/versions/node/v22.18.0/bin:$PATH"
Then log out and back in (or restart). After that, VS Code was able to
find claude even when launched from the icon.
Alternative
As a quick workaround, launching VS Code from the terminal also works:
code .
Or, if you prefer, you can set the PATH just for VS Code by adding this
to settings.json:
"terminal.integrated.env.linux": {
"PATH": "/home/<your-username>/.nvm/versions/node/v22.18.0/bin:${env:PATH}"
}
✅ After adding it to ~/.profile, the extension worked correctly
without needing to launch VS Code from the terminal.