feat: china-first openclaw install (npmmirror fallback to npmjs)
This commit is contained in:
@@ -186,12 +186,27 @@ if (Get-Command git -ErrorAction SilentlyContinue) {
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# Step 3: Install / Update OpenClaw
|
||||
# China-first path: npmmirror → npmjs (if needed)
|
||||
# ─────────────────────────────────────────────
|
||||
Write-Info "Installing / updating OpenClaw..."
|
||||
|
||||
npm install -g openclaw@latest 2>&1 | Write-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Err "OpenClaw installation failed. Please run manually: npm install -g openclaw@latest"
|
||||
function Install-OpenClawByRegistry($registry) {
|
||||
Write-Info "Trying npm install via $registry ..."
|
||||
npm install -g openclaw@latest --registry=$registry 2>&1 | Write-Host
|
||||
return ($LASTEXITCODE -eq 0)
|
||||
}
|
||||
|
||||
$installedOpenClaw = $false
|
||||
if (Install-OpenClawByRegistry "https://registry.npmmirror.com") {
|
||||
Write-Ok "OpenClaw installed / updated via npmmirror."
|
||||
$installedOpenClaw = $true
|
||||
} elseif (Install-OpenClawByRegistry "https://registry.npmjs.org") {
|
||||
Write-Ok "OpenClaw installed / updated via npm registry."
|
||||
$installedOpenClaw = $true
|
||||
}
|
||||
|
||||
if (-not $installedOpenClaw) {
|
||||
Write-Err "OpenClaw installation failed: both npmmirror and npm registry are unavailable."
|
||||
}
|
||||
|
||||
# Refresh PATH
|
||||
|
||||
Reference in New Issue
Block a user