Skip to content

Commit aca9c74

Browse files
committed
ps1 fix
1 parent f9225e9 commit aca9c74

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

install.ps1

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,28 @@ if (Test-CommandExists "pnpm") {
142142
$pnpmVersion = (pnpm -v)
143143
Write-Success "pnpm found: v$pnpmVersion"
144144
} else {
145-
Write-Info "Installing pnpm globally..."
146-
npm install -g pnpm
147-
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
145+
Write-Info "Installing pnpm..."
146+
# Try corepack first (built into Node 22+, avoids execution policy issues)
147+
try {
148+
corepack enable 2>$null
149+
corepack prepare pnpm@latest --activate 2>$null
150+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
151+
} catch {}
152+
153+
if (-not (Test-CommandExists "pnpm")) {
154+
Write-Info "Corepack method unavailable, trying npm install..."
155+
# Temporarily bypass execution policy for this process
156+
try { Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force } catch {}
157+
npm install -g pnpm
158+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
159+
}
160+
148161
if (Test-CommandExists "pnpm") {
149162
Write-Success "pnpm installed successfully!"
150163
} else {
151-
Write-Fail "pnpm installation failed. Try running: npm install -g pnpm"
164+
Write-Fail "pnpm installation failed."
165+
Write-Host " Fix: Run this command first, then re-run the installer:" -ForegroundColor Gray
166+
Write-Host " Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" -ForegroundColor White
152167
exit 1
153168
}
154169
}

0 commit comments

Comments
 (0)