fix(portable/setup.ps1): cd to core dir before npm install
When users run setup.ps1 from PowerShell with cwd outside the repo (e.g. C:\Users\Admin>), npm 11 walks up looking for package.json and errors with ENOENT before honoring --prefix. setup.bat already pushd's into core; setup.ps1 was missing the equivalent Push-Location guard. Fixes #27 (setup.ps1 ENOENT package.json reported by lawler-code).
This commit is contained in:
@@ -224,7 +224,13 @@ if (Test-Path -Path (Join-Path $coreDir "node_modules\openclaw") -PathType Conta
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Step "->" "Installing OpenClaw..." "Cyan"
|
Write-Step "->" "Installing OpenClaw..." "Cyan"
|
||||||
& $npmCmd install --prefix $coreDir --registry=$mirror
|
Push-Location $coreDir
|
||||||
|
try {
|
||||||
|
& $npmCmd install --prefix $coreDir --registry=$mirror
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
if (Test-Path -Path (Join-Path $coreDir "node_modules\openclaw") -PathType Container) {
|
if (Test-Path -Path (Join-Path $coreDir "node_modules\openclaw") -PathType Container) {
|
||||||
Write-Step "OK" "OpenClaw installation completed." "Green"
|
Write-Step "OK" "OpenClaw installation completed." "Green"
|
||||||
@@ -240,11 +246,15 @@ if (Test-Path -Path (Join-Path $coreDir "node_modules\@sliverp\qqbot") -PathType
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Step "->" "Installing QQ plugin..." "Cyan"
|
Write-Step "->" "Installing QQ plugin..." "Cyan"
|
||||||
|
Push-Location $coreDir
|
||||||
try {
|
try {
|
||||||
& $npmCmd install @sliverp/qqbot@latest --prefix $coreDir --registry=$mirror 2>$null
|
& $npmCmd install "@sliverp/qqbot@latest" --prefix $coreDir --registry=$mirror 2>$null
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
Write-Step "OK" "QQ plugin installation finished." "Green"
|
Write-Step "OK" "QQ plugin installation finished." "Green"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user