From c36cfa89e70249571c91f1dc81cfd8f9534aec75 Mon Sep 17 00:00:00 2001 From: Jerry Chae Date: Wed, 13 May 2026 16:43:51 +0900 Subject: [PATCH] =?UTF-8?q?PATH=20=EA=B4=80=EB=A0=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install-pi.ps1 | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/install-pi.ps1 b/install-pi.ps1 index 6f847a4..ca2c617 100644 --- a/install-pi.ps1 +++ b/install-pi.ps1 @@ -130,7 +130,7 @@ if (-not $piBin) { } } -# 4) Try well-known locations +# 4) Try well-known locations (including pi-node versioned installs) if (-not $piBin) { $candidates = @( (Join-Path $env:APPDATA 'npm\pi.cmd'), @@ -141,6 +141,15 @@ if (-not $piBin) { foreach ($c in $candidates) { if (Test-Path $c) { $piBin = $c; break } } + + # Search for pi-node versioned installs (e.g. pi-node/node-v22.22.2-win-x64/bin/pi.cmd) + if (-not $piBin) { + $piNodeDir = Join-Path $env:USERPROFILE '.local\share\pi-node' + if (Test-Path $piNodeDir) { + $found = Get-ChildItem -Path $piNodeDir -Recurse -Filter 'pi.cmd' -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($found) { $piBin = $found.FullName } + } + } } if ($piBin) { @@ -151,6 +160,15 @@ if ($piBin) { Info "Added $piDir to PATH for this session" } Success "Pi is available: $piBin" + + # Permanently add pi's directory to user PATH if not already there + $userPath = [System.Environment]::GetEnvironmentVariable('Path', 'User') + if ($userPath -notlike "*$piDir*") { + [System.Environment]::SetEnvironmentVariable('Path', "$piDir;$userPath", 'User') + Success "Added $piDir to user PATH permanently (takes effect on next login)" + } else { + Info "$piDir already in user PATH" + } } else { ErrExit "'pi' command not found after installation. Check your PATH or reinstall Node.js." } @@ -215,13 +233,6 @@ Info "==================================================" Info "" Info "Pi binary: $piBin" Info "" -$piDir = Split-Path $piBin -$userPath = [System.Environment]::GetEnvironmentVariable('Path', 'User') -if ($userPath -notlike "*$piDir*") { - Info "NOTE: Add $piDir to your PATH permanently by running:" - Info " [System.Environment]::SetEnvironmentVariable('Path', '$piDir;' + [System.Environment]::GetEnvironmentVariable('Path', 'User'), 'User')" -} -Info "" Info "Getting started:" Info " 1. Navigate to your project: cd C:\path\to\project" Info " 2. Start Pi: pi"