fix(install): 修复 Windows 安装时下载卡住的 bug
- install.ps1: 修复镜像 URL 拼接错误($BUNDLE_URL 已含完整域名导致双重 https://) - install.ps1: 替换失效镜像(gh-proxy.com/mirror.ghproxy.com),改用实测可用的 ghproxy.net 和 gh.idayer.com - install.ps1: curl fallback 同步修正 URL,加 --retry 2 - install.ps1: 下载失败时打印手动下载地址,便于用户自助 - install.ps1: 修正步骤编号跳号问题 [1/7]~[7/7] → [1/6]~[6/6](实际共 6 步) - install.sh: 同步 Node.js 版本 v22.14.0 → v22.16.0,与 Windows 版保持一致 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -78,7 +78,7 @@ New-Item -ItemType Directory -Force -Path "$DATA_DIR\backups" | Out-Null
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# Step 2: Node.js
|
# Step 2: Node.js
|
||||||
# ============================================================
|
# ============================================================
|
||||||
Write-Host " [1/7] Install Node.js $NODE_VERSION ..." -ForegroundColor White
|
Write-Host " [1/6] Install Node.js $NODE_VERSION ..." -ForegroundColor White
|
||||||
|
|
||||||
$NODE_INSTALL_DIR = "$RUNTIME_DIR\node-$PLATFORM"
|
$NODE_INSTALL_DIR = "$RUNTIME_DIR\node-$PLATFORM"
|
||||||
$INSTALL_NODE = ""
|
$INSTALL_NODE = ""
|
||||||
@@ -158,18 +158,18 @@ Write-Host ""
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# Step 3: OpenClaw + QQ plugin (pre-bundled download)
|
# Step 3: OpenClaw + QQ plugin (pre-bundled download)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
Write-Host " [2/7] Install OpenClaw + QQ plugin ..." -ForegroundColor White
|
Write-Host " [2/6] Install OpenClaw + QQ plugin ..." -ForegroundColor White
|
||||||
|
|
||||||
if (Test-Path "$CORE_DIR\node_modules\openclaw") {
|
if (Test-Path "$CORE_DIR\node_modules\openclaw") {
|
||||||
Write-Green " [OK] OpenClaw already installed, skip"
|
Write-Green " [OK] OpenClaw already installed, skip"
|
||||||
} else {
|
} else {
|
||||||
Write-Cyan " Downloading pre-bundled package (no npm install needed)..."
|
Write-Cyan " Downloading pre-bundled package (no npm install needed)..."
|
||||||
$BUNDLE_URL = "https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip"
|
$BUNDLE_GITHUB_URL = "https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip"
|
||||||
$BUNDLE_MIRRORS = @(
|
$BUNDLE_MIRRORS = @(
|
||||||
"https://ghfast.top/$BUNDLE_URL",
|
"https://ghfast.top/https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip",
|
||||||
"https://gh-proxy.com/$BUNDLE_URL",
|
"https://ghproxy.net/https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip",
|
||||||
"https://mirror.ghproxy.com/$BUNDLE_URL",
|
"https://gh.idayer.com/https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip",
|
||||||
$BUNDLE_URL
|
$BUNDLE_GITHUB_URL
|
||||||
)
|
)
|
||||||
$bundleZip = "$env:TEMP\openclaw-bundle.zip"
|
$bundleZip = "$env:TEMP\openclaw-bundle.zip"
|
||||||
$downloaded = $false
|
$downloaded = $false
|
||||||
@@ -179,26 +179,44 @@ if (Test-Path "$CORE_DIR\node_modules\openclaw") {
|
|||||||
try {
|
try {
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
Invoke-WebRequest -Uri $mirrorUrl -OutFile $bundleZip -UseBasicParsing -TimeoutSec 60
|
Invoke-WebRequest -Uri $mirrorUrl -OutFile $bundleZip -UseBasicParsing -TimeoutSec 120
|
||||||
if ((Get-Item $bundleZip).Length -gt 1MB) {
|
if (Test-Path $bundleZip) {
|
||||||
|
$fileSize = (Get-Item $bundleZip).Length
|
||||||
|
if ($fileSize -gt 1MB) {
|
||||||
|
Write-Host " Downloaded ($([math]::Round($fileSize/1MB,1)) MB)" -ForegroundColor DarkGray
|
||||||
$downloaded = $true
|
$downloaded = $true
|
||||||
break
|
break
|
||||||
|
} else {
|
||||||
|
Write-Host " File too small ($fileSize bytes), trying next..." -ForegroundColor DarkGray
|
||||||
|
Remove-Item -Force $bundleZip -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host " Failed, trying next..." -ForegroundColor DarkGray
|
Write-Host " Failed: $($_.Exception.Message.Split([char]10)[0])" -ForegroundColor DarkGray
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $downloaded) {
|
if (-not $downloaded) {
|
||||||
Write-Host " Trying curl..." -ForegroundColor DarkGray
|
Write-Host " Trying curl fallback..." -ForegroundColor DarkGray
|
||||||
|
$curlMirrors = @(
|
||||||
|
"https://ghfast.top/https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip",
|
||||||
|
"https://ghproxy.net/https://github.com/dongsheng123132/u-claw/releases/download/v1.0.0-bundle/openclaw-bundle.zip",
|
||||||
|
$BUNDLE_GITHUB_URL
|
||||||
|
)
|
||||||
|
foreach ($curlUrl in $curlMirrors) {
|
||||||
try {
|
try {
|
||||||
& curl.exe -sL "https://ghfast.top/$BUNDLE_URL" -o $bundleZip
|
& curl.exe -L --max-time 120 --retry 2 $curlUrl -o $bundleZip 2>$null
|
||||||
if ((Get-Item $bundleZip).Length -gt 1MB) { $downloaded = $true }
|
if (Test-Path $bundleZip) {
|
||||||
|
if ((Get-Item $bundleZip).Length -gt 1MB) { $downloaded = $true; break }
|
||||||
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (-not $downloaded) {
|
if (-not $downloaded) {
|
||||||
Write-Red " [FAIL] Download failed! Check your network."
|
Write-Red " [FAIL] Download failed! Check your network."
|
||||||
|
Write-Yellow " Manual download: $BUNDLE_GITHUB_URL"
|
||||||
|
Write-Yellow " Place file at: $bundleZip then re-run installer"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +250,7 @@ Write-Host ""
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# Step 4: China-optimized skills (10 skills)
|
# Step 4: China-optimized skills (10 skills)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
Write-Host " [4/7] Install China skills (10) ..." -ForegroundColor White
|
Write-Host " [3/6] Install China skills (10) ..." -ForegroundColor White
|
||||||
|
|
||||||
$SKILLS_TARGET = "$CORE_DIR\node_modules\openclaw\skills"
|
$SKILLS_TARGET = "$CORE_DIR\node_modules\openclaw\skills"
|
||||||
if (-not (Test-Path $SKILLS_TARGET)) { New-Item -ItemType Directory -Force -Path $SKILLS_TARGET | Out-Null }
|
if (-not (Test-Path $SKILLS_TARGET)) { New-Item -ItemType Directory -Force -Path $SKILLS_TARGET | Out-Null }
|
||||||
@@ -440,7 +458,7 @@ Write-Host ""
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# Step 5: Model configuration
|
# Step 5: Model configuration
|
||||||
# ============================================================
|
# ============================================================
|
||||||
Write-Host " [5/7] Configure AI model ..." -ForegroundColor White
|
Write-Host " [4/6] Configure AI model ..." -ForegroundColor White
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
$hasConfig = (Test-Path $CONFIG_PATH) -and (Select-String -Path $CONFIG_PATH -Pattern "apiKey" -Quiet -ErrorAction SilentlyContinue)
|
$hasConfig = (Test-Path $CONFIG_PATH) -and (Select-String -Path $CONFIG_PATH -Pattern "apiKey" -Quiet -ErrorAction SilentlyContinue)
|
||||||
@@ -540,7 +558,7 @@ Write-Host ""
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# Step 6: Generate start scripts
|
# Step 6: Generate start scripts
|
||||||
# ============================================================
|
# ============================================================
|
||||||
Write-Host " [6/7] Generate start scripts ..." -ForegroundColor White
|
Write-Host " [5/6] Generate start scripts ..." -ForegroundColor White
|
||||||
|
|
||||||
$startBat = @'
|
$startBat = @'
|
||||||
@echo off
|
@echo off
|
||||||
@@ -620,7 +638,7 @@ Write-Host ""
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# Step 7: Verify
|
# Step 7: Verify
|
||||||
# ============================================================
|
# ============================================================
|
||||||
Write-Host " [7/7] Verify installation ..." -ForegroundColor White
|
Write-Host " [6/6] Verify installation ..." -ForegroundColor White
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ RUNTIME_DIR="$UCLAW_DIR/runtime"
|
|||||||
CORE_DIR="$UCLAW_DIR/core"
|
CORE_DIR="$UCLAW_DIR/core"
|
||||||
DATA_DIR="$UCLAW_DIR/data"
|
DATA_DIR="$UCLAW_DIR/data"
|
||||||
CONFIG_PATH="$DATA_DIR/.openclaw/openclaw.json"
|
CONFIG_PATH="$DATA_DIR/.openclaw/openclaw.json"
|
||||||
NODE_VERSION="v22.14.0"
|
NODE_VERSION="v22.16.0"
|
||||||
MIRROR="https://registry.npmmirror.com"
|
MIRROR="https://registry.npmmirror.com"
|
||||||
NODE_MIRROR="https://npmmirror.com/mirrors/node"
|
NODE_MIRROR="https://npmmirror.com/mirrors/node"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user