From 5b925854f0549b8650f1373fb60d71e353f1296c Mon Sep 17 00:00:00 2001 From: oliver Date: Thu, 7 May 2026 15:09:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(whatsapp):=20=E5=9B=BA=E5=AE=9A=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC=E5=B9=B6=E8=A7=84?= =?UTF-8?q?=E9=81=BF=E5=AF=BC=E5=87=BA=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 whatsapp 安装脚本改为固定版本安装 baileys/tsx/typescript 等依赖,并在安装前移除 whatsapp-rust-bridge,降低 ERR_PACKAGE_PATH_NOT_EXPORTED 兼容性问题。 Co-authored-by: Cursor --- runtime/operations/scripts/whatsapp_install.ps1 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/runtime/operations/scripts/whatsapp_install.ps1 b/runtime/operations/scripts/whatsapp_install.ps1 index b7b75616..daeadcba 100644 --- a/runtime/operations/scripts/whatsapp_install.ps1 +++ b/runtime/operations/scripts/whatsapp_install.ps1 @@ -20,6 +20,13 @@ $stateDir = Join-Path $sidecarRoot "state" $logDir = Join-Path $sidecarRoot "logs" $bridgeSrc = Join-Path $oclawRoot "runtime\\operations\\whatsapp_bridge" +# Pin known-good versions to avoid breakage from upstream latest releases. +$baileysVersion = "7.0.0-rc.9" +$qrcodeVersion = "0.12.0" +$httpsProxyAgentVersion = "7.0.6" +$tsxVersion = "4.20.3" +$typescriptVersion = "5.8.2" + New-Item -ItemType Directory -Force -Path $sidecarRoot | Out-Null New-Item -ItemType Directory -Force -Path $stateDir | Out-Null New-Item -ItemType Directory -Force -Path $logDir | Out-Null @@ -30,11 +37,14 @@ try { npm.cmd init -y | Out-Null if ($LASTEXITCODE -ne 0) { throw "npm init failed with exit code $LASTEXITCODE" } } - npm.cmd install --save @whiskeysockets/baileys@latest qrcode-terminal@latest + # Remove problematic package when present (seen on some environments with latest dependency graph). + npm.cmd remove whatsapp-rust-bridge | Out-Null + + npm.cmd install --save --save-exact @whiskeysockets/baileys@$baileysVersion qrcode-terminal@$qrcodeVersion if ($LASTEXITCODE -ne 0) { throw "npm install deps failed with exit code $LASTEXITCODE" } - npm.cmd install --save https-proxy-agent@latest + npm.cmd install --save --save-exact https-proxy-agent@$httpsProxyAgentVersion if ($LASTEXITCODE -ne 0) { throw "npm install proxy deps failed with exit code $LASTEXITCODE" } - npm.cmd install --save tsx@latest typescript@latest + npm.cmd install --save --save-exact tsx@$tsxVersion typescript@$typescriptVersion if ($LASTEXITCODE -ne 0) { throw "npm install dev deps failed with exit code $LASTEXITCODE" } } finally { Pop-Location