Thursday, August 13, 2026

Claude Command not working on VS code terminal

Because VS Code handles shell environments differently than your native system terminal, it often fails to inherit newly updated paths until explicitly configured.

1. Identify Your Global NPM Bin Path

You need to find exactly where npm is saving your global commands. Run this command inside your VS Code terminal:
npm config get prefix
  • Windows Example Output: C:\Users\YourName\AppData\Roaming\npm
  • Mac/Linux Example Output: /usr/local or /Users/YourName/.npm-global [2, 3]

2. Inject the Path into Your Shell Config

If you are on Mac/Linux (Zsh or Bash):

Open your shell profile configuration file (e.g., ~/.zshrc or ~/.bashrc) and append the binary folder path to your environment file. [4]
echo 'export PATH="'$(npm config get prefix)'/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
(Change .zshrc to .bashrc if your VS Code terminal says bash in the top corner).

If you are on Windows (PowerShell):

Windows handles global paths differently. Run this command in your VS Code PowerShell window to permanently append the path to your user environment:
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$([Environment]::GetFolderPath('ApplicationData'))\npm", "User")

3. Force VS Code to Refresh the Environment

VS Code aggressively caches environment paths. It will not recognize the fixes above in your current session.
  1. Fully close all open VS Code windows.
  2. Reopen VS Code.
  3. Open a fresh terminal session (Ctrl + ~) and type:
    claude