PATH 관련 수정
This commit is contained in:
1 parent
4af780d31f
commit
c36cfa89e7
1 file changed
+19
-8
+19
-8
@@ -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) {
|
if (-not $piBin) {
|
||||||
$candidates = @(
|
$candidates = @(
|
||||||
(Join-Path $env:APPDATA 'npm\pi.cmd'),
|
(Join-Path $env:APPDATA 'npm\pi.cmd'),
|
||||||
@@ -141,6 +141,15 @@ if (-not $piBin) {
|
|||||||
foreach ($c in $candidates) {
|
foreach ($c in $candidates) {
|
||||||
if (Test-Path $c) { $piBin = $c; break }
|
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) {
|
if ($piBin) {
|
||||||
@@ -151,6 +160,15 @@ if ($piBin) {
|
|||||||
Info "Added $piDir to PATH for this session"
|
Info "Added $piDir to PATH for this session"
|
||||||
}
|
}
|
||||||
Success "Pi is available: $piBin"
|
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 {
|
} else {
|
||||||
ErrExit "'pi' command not found after installation. Check your PATH or reinstall Node.js."
|
ErrExit "'pi' command not found after installation. Check your PATH or reinstall Node.js."
|
||||||
}
|
}
|
||||||
@@ -215,13 +233,6 @@ Info "=================================================="
|
|||||||
Info ""
|
Info ""
|
||||||
Info "Pi binary: $piBin"
|
Info "Pi binary: $piBin"
|
||||||
Info ""
|
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 "Getting started:"
|
||||||
Info " 1. Navigate to your project: cd C:\path\to\project"
|
Info " 1. Navigate to your project: cd C:\path\to\project"
|
||||||
Info " 2. Start Pi: pi"
|
Info " 2. Start Pi: pi"
|
||||||
|
|||||||
Reference in new issue
Block a user