Skip to content

docs: add PATH fix instructions to installation troubleshooting#1459

Merged
tamirdresher merged 1 commit into
bradygaster:devfrom
johnazariah:johnazariah-docs-fix-path-troubleshooting-1458
Jul 17, 2026
Merged

docs: add PATH fix instructions to installation troubleshooting#1459
tamirdresher merged 1 commit into
bradygaster:devfrom
johnazariah:johnazariah-docs-fix-path-troubleshooting-1458

Conversation

@johnazariah

Copy link
Copy Markdown
Contributor

The troubleshooting section for squad: command not found previously told users to check their PATH but didn't explain how to actually fix it when the npm global prefix directory isn't in PATH.

This adds platform-specific instructions for:

  • Finding the npm global bin directory with npm prefix -g
  • Adding it to PATH on macOS/Linux (shell profile)
  • Adding it to PATH on Windows (PowerShell environment variable)

Fixes #1458

@johnazariah
johnazariah requested a review from bradygaster as a code owner July 9, 2026 22:49
Copilot AI review requested due to automatic review settings July 9, 2026 22:49
@johnazariah
johnazariah requested a review from tamirdresher as a code owner July 9, 2026 22:49
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit ee6ebc4

PR Scope: 🔧 Infrastructure

⚠️ 3 item(s) to address before review

Status Check Details
Single commit 1 commit — clean history
Not in draft Ready for review
Branch up to date dev is 17 commit(s) ahead — rebase recommended
Copilot review No Copilot review yet — it may still be processing
Changeset present No source files changed — changeset not required
Scope clean No .squad/ or docs/proposals/ files
No merge conflicts No merge conflicts
Copilot threads resolved 0 active Copilot thread(s) resolved (2 outdated skipped)
CI passing 4 check(s) still running

Files Changed (1 file, +65 −5)

File +/−
docs/src/content/docs/get-started/installation.md +65 −5

Total: +65 −5


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🟢 Impact Analysis — PR #1459

Risk tier: 🟢 LOW

📊 Summary

Metric Count
Files changed 1
Files added 0
Files modified 1
Files deleted 0
Modules touched 1

🎯 Risk Factors

  • 1 files changed (≤5 → LOW)
  • 1 module(s) touched (≤1 → LOW)

📦 Modules Affected

docs (1 file)
  • docs/src/content/docs/get-started/installation.md

This report is generated automatically for every PR. See #733 for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the installation troubleshooting docs to give actionable, platform-specific steps for resolving squad: command not found when the npm global install location isn’t on PATH, addressing the gap described in issue #1458.

Changes:

  • Adds a step-by-step troubleshooting flow (confirm install → find global prefix → update PATH → verify).
  • Documents how to locate the global prefix with npm prefix -g and where the squad binary is expected to live on macOS/Linux vs Windows.
  • Provides platform-specific PATH update instructions using shell profiles (macOS/Linux) and PowerShell (Windows).

Run this in PowerShell to permanently add the npm global directory to your user PATH:

```powershell
[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";" + (npm prefix -g), "User")
Then reload your shell:

```bash
source ~/.bashrc # or ~/.zshrc
@tamirdresher

Copy link
Copy Markdown
Collaborator

Thanks for the improved docs structure — the step-by-step approach is much better than the old 'check your PATH' stub.

One blocking issue with the Windows PowerShell command:

\\powershell

Current (buggy):

[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";" + (npm prefix -g), "User")
\\

\\C:\Program Files\PowerShell\7;C:\Users\tamirdresher\AppData\Local\Programs\GitHub Copilot;C:\Users\tamirdresher\AppData\Local\github-copilot-git-2.53.0-3\cmd;C:\Users\tamirdresher\AppData\Local\github-copilot-git-2.53.0-3\mingw64\bin;C:\Users\tamirdresher\AppData\Local\github-copilot-git-2.53.0-3\mingw64\usr\bin;C:\Users\tamirdresher\AppData\Local\copilot-desktop-gh-2.96.0;C:\Program Files\Microsoft\jdk-21.0.10.7-hotspot\bin;C:\Program Files\Microsoft\jdk-17.0.18.8-hotspot\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:.Tools\agency\CurrentVersion;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Azure Dev CLI;C:\Program Files\GitHub CLI;C:\Program Files\Microsoft SQL Server\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft VS Code\bin;C:.tools\dotnet;C:.tools.npm-global;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn;C:\Users\vmadmin\AppData\Local\Microsoft\WindowsApps;c:\nvm;C:\Program Files\nodejs;C:\ES.DevProd\SpringBoard\SBCli\SpringBoardCli;C:\Program Files\GVFS;C:\ES.DevProd\VMSetupScripts;C:\ProgramData\global-npm;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft Dev Box Agent\Scripts;C:\Program Files\dotnet;C:\Program Files\Go\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Git\cmd;C:\Program Files\PowerShell\7;C:\Users\tamirdresher.cargo\bin;C:\Ruby32\bin;C:\Ruby33\bin;C:\Ruby330\bin;C:\Ruby330-x64\bin;C:\Users\tamirdresher\AppData\Local\Programs\Python\Python312\Scripts;C:\Users\tamirdresher\AppData\Local\Programs\Python\Python312;C:\Users\tamirdresher\AppData\Local\Programs\Python\Launcher;C:\Users\tamirdresher\AppData\Local\Microsoft\WindowsApps;C:\Users\tamirdresher\AppData\Local\Microsoft\WinGet\Links;C:\Users\tamirdresher.dotnet\tools;C:\Users\tamirdresher.azure-kubectl;C:\Users\tamirdresher.azure-kubelogin;C:\Users\tamirdresher\go\bin;C:\Users\tamirdresher\AppData\Local\Programs\AzureAuth\0.9.6\\ contains the combined Machine + User PATH entries (inherited at shell startup). Writing that back to the User registry key permanently duplicates all Machine-level paths into User PATH, bloating and corrupting it.

Fix:
\\powershell
[Environment]::SetEnvironmentVariable("PATH", [Environment]::GetEnvironmentVariable("PATH","User") + ";" + (npm prefix -g), "User")
\\

This reads only the existing User-scoped PATH before appending.

Minor suggestion: a brief caveat for nvm/fnm users (their npm prefix points to a shim directory) would prevent follow-up support issues.

@tamirdresher tamirdresher left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two blocking issues in the "squad: command not found" section — please address both.

1. Windows PowerShell snippet corrupts User PATH

Under Windows (PowerShell) the snippet reads $env:PATH and writes it back to the User scope:

[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";" + (npm prefix -g), "User")

$env:PATH is the process PATH (Machine PATH + User PATH merged at shell startup). Writing it back to the User scope permanently duplicates every Machine entry into the User PATH. Repeat runs also duplicate npm prefix -g. Over time this bloats User PATH toward the 8191-char registry limit and can corrupt it.

Please read only the User scope and dedup before appending:

$npmPrefix = (npm prefix -g).Trim()
$userPath  = [Environment]::GetEnvironmentVariable("PATH", "User")
if (-not (($userPath -split ';') -contains $npmPrefix)) {
    $newUserPath = if ([string]::IsNullOrEmpty($userPath)) { $npmPrefix } else { $userPath.TrimEnd(';') + ";" + $npmPrefix }
    [Environment]::SetEnvironmentVariable("PATH", $newUserPath, "User")
}

2. Shell-reload line is labelled for two shells but only runs one

Under macOS / Linux the reload step says:

source ~/.bashrc   # or ~/.zshrc

That literally sources ~/.bashrc even when the user's shell is zsh — the # or ~/.zshrc is only a comment. Please give two genuinely separate commands so users pick the right one:

# Bash
source ~/.bashrc
# Zsh
source ~/.zshrc

Once these two are fixed I'll re-review.

@johnazariah

Copy link
Copy Markdown
Contributor Author

Thanks @tamirdresher — addressed both blocking items plus your nvm/fnm suggestion in 8255ddac:

1. Windows PowerShell PATH corruption — the snippet now reads only the User-scoped PATH via [Environment]::GetEnvironmentVariable("PATH", "User") and skips the append when the npm prefix is already present, so it no longer duplicates Machine-level entries or re-adds the prefix on repeat runs:

$npmPrefix = (npm prefix -g).Trim()
$userPath  = [Environment]::GetEnvironmentVariable("PATH", "User")
if (-not (($userPath -split ';') -contains $npmPrefix)) {
    $newUserPath = if ([string]::IsNullOrEmpty($userPath)) { $npmPrefix } else { $userPath.TrimEnd(';') + ";" + $npmPrefix }
    [Environment]::SetEnvironmentVariable("PATH", $newUserPath, "User")
}

2. Shell-reload step — split into two genuinely separate Bash and Zsh commands instead of sourcing ~/.bashrc with a # or ~/.zshrc comment.

Bonus — added a :::note caveat for nvm/fnm users, since npm prefix -g there points to a version-specific shim directory.

Docs build + build-output tests pass locally. Ready for re-review.

Expand the `squad: command not found` troubleshooting section with
actionable, platform-specific steps for getting the npm global bin
directory onto PATH:

- Confirm the install, locate the global prefix with `npm prefix -g`,
  update PATH, and verify.
- macOS/Linux: add the export line to a shell profile, with separate
  Bash (`source ~/.bashrc`) and Zsh (`source ~/.zshrc`) reload commands.
- Windows (PowerShell): append the npm prefix to the User-scoped PATH,
  reading only the User scope and deduping so repeated runs don't
  duplicate entries or copy Machine-level paths into User PATH.
- Add an nvm/fnm caveat noting `npm prefix -g` points to a
  version-specific directory.

Closes bradygaster#1458

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@tamirdresher tamirdresher left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Head verified at ee6ebc489fcd87942232439f8eb127705bba0608, checks are green, and the previously requested blockers are all addressed: Windows PowerShell now updates only the User-scoped PATH ([Environment]::GetEnvironmentVariable("PATH","User")), duplicates are prevented (-notcontains $npmPrefix), whitespace is trimmed on the read and the trailing ; is stripped, bash and zsh have separate code blocks, and there is now explicit nvm/fnm guidance. This new APPROVE explicitly supersedes my earlier CHANGES_REQUESTED from 2026-07-13. Not merging — leaving that to maintainers.

@tamirdresher
tamirdresher merged commit ce16bfc into bradygaster:dev Jul 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Troubleshooting section tells users to check PATH but doesn't show how to fix it

3 participants