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:- Windows Example Output:
C:\Users\YourName\AppData\Roaming\npm - Mac/Linux Example Output:
/usr/localor/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] (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:
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.
- Fully close all open VS Code windows.
- Reopen VS Code.
- Open a fresh terminal session (
Ctrl + ~) and type:
No comments:
Post a Comment