fix: Windows ExecutionPolicy error — set Bypass + remove .ps1 wrapper
npm creates claude.ps1 wrapper which gets blocked by default PS ExecutionPolicy. Fix: set Bypass for CurrentUser and remove the .ps1 wrapper (claude.cmd still works fine). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
# Fix PS execution policy so claude.ps1 wrapper works
|
||||
try {
|
||||
Set-ExecutionPolicy Bypass -Scope CurrentUser -Force 2>$null
|
||||
} catch {}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
||||
Write-Host " | Claude Code -- Windows Installer |" -ForegroundColor Cyan
|
||||
@@ -194,6 +199,17 @@ if (-not (Test-Path $claudeJson)) {
|
||||
Write-Host " Onboarding: already configured" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# ---- Remove .ps1 wrapper (prevents ExecutionPolicy errors) ----
|
||||
|
||||
$npmPrefix = (npm prefix -g 2>$null)
|
||||
if ($npmPrefix) {
|
||||
$ps1Wrapper = Join-Path $npmPrefix "claude.ps1"
|
||||
if (Test-Path $ps1Wrapper) {
|
||||
Remove-Item $ps1Wrapper -Force -ErrorAction SilentlyContinue
|
||||
Write-Host " Removed claude.ps1 wrapper (using .cmd instead)" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
# ---- Verify ----
|
||||
|
||||
Write-Host ""
|
||||
|
||||
Reference in New Issue
Block a user