#!/usr/bin/env bash # scripts/install-playwright-deps.sh # Instala dependencias del sistema necesarias para Playwright y descarga Chromium. # Funciona en Debian/Ubuntu/Kali (apt). Incluye comprobaciones básicas y fallback. set -euo pipefail echo "== Playwright deps installer ==" OS_ID="$(. /etc/os-release 2>/dev/null && echo "$ID" || echo unknown)" echo "Detected OS: ${OS_ID}" if command -v apt-get >/dev/null 2>&1; then echo "Using apt-get to install system packages (Debian/Ubuntu/Kali)..." sudo apt-get update sudo apt-get install -y --no-install-recommends \ ca-certificates wget gnupg lsb-release \ libnss3 libx11-6 libx11-xcb1 libxss1 libasound2 libatk1.0-0 libatk-bridge2.0-0 \ libcups2 libdrm2 libxrandr2 libgbm1 libgtk-3-0 libpangocairo-1.0-0 libxcb1 \ libxcomposite1 libxdamage1 libpango-1.0-0 libxcursor1 libxshmfence1 fonts-noto-color-emoji \ libxkbcommon0 libatspi2.0-0 echo "System packages installed." else echo "Non-apt system detected. Please install Playwright dependencies manually." echo "See https://playwright.dev/docs/troubleshooting#missing-dependencies for distro-specific list." fi # Ensure node_modules exists cd "$(dirname "$0")/.." || true PKGDIR="$(pwd)/packages/broadcast-panel" if [ -d "$PKGDIR" ]; then echo "Installing Playwright browsers in $PKGDIR..." (cd "$PKGDIR" && npm install --no-audit --no-fund) || true # install the chromium browser runtime for playwright (cd "$PKGDIR" && npx playwright install chromium) || true echo "Playwright browsers installed (chromium)." else echo "Could not find $PKGDIR. Run the installer from the project root." fi echo "If your environment is not supported, Playwright may download a fallback ubuntu20.04-x64 build — that's expected on some distros." echo "Done. If you still see warnings, paste the /tmp/dify-plugin-output.log here and I will help debug further."