Fixing "copilot is not recognized" on Windows
When I tried to set up copilot-cli on Windows, the command failed with:
'copilot' is not recognized as an internal or external command,
operable program or batch file.
This post explains why it happens and how to fix it quickly.
Root Cause
I originally ran:
npm run @github/copilot
That command is not an install command. npm run only executes scripts defined in package.json, so it does not install @github/copilot globally.
Correct Installation
Install the CLI globally:
npm install -g @github/copilot
Verify installation:
copilot --version
If copilot Is Still Not Found
If the package is installed but the shell still cannot find copilot, your npm global bin path is likely missing from PATH.
1) Check npm global prefix
npm config get prefix
Common output examples:
C:\Users\<you>\AppData\Roaming\npmC:\Program Files\nodejs
2) Check whether PATH already contains npm-related entries
$env:Path -split ';' | Where-Object { $_ -like '*npm*' }
3) Add npm global bin to user PATH (if needed)
$npmPrefix = npm config get prefix
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$npmPrefix", "User")
Restart PowerShell and run:
copilot --version
Fast Alternative: Use npx
If you want to avoid PATH issues, run the CLI with npx:
npx @github/copilot --version
npx @github/copilot <command>
This is often the fastest way to get started.
Recommended Workflow
For stability and convenience on Windows:
- Install globally with
npm install -g @github/copilot - Verify with
copilot --version - If unresolved, use
npx @github/copilot ...while fixingPATH
That sequence resolves most setup problems in a few minutes.