zarazhangrui/frontend-slides · error

${RED}✗${NC} $*

Error message

${RED}✗${NC} $*

What it means

This is the err() helper defined at line 32 of export-pdf.sh, a bash wrapper that exports an HTML slide deck to PDF via a generated Playwright Node script. err() prints a red ✗ and its message to stderr, then the script exits 1. It fires on usage/validation failures (missing argument, file not found), dependency failures (no Node, Playwright or Chromium install failure), or when the embedded Node export script exits non-zero ('PDF export failed.').

Source

Thrown at plugins/frontend-slides/skills/frontend-slides/scripts/export-pdf.sh:32

#   3. Combines all screenshots into a single PDF
#   4. Cleans up the server and temp files
#
# The PDF preserves colors, fonts, and layout — but not animations.
# Perfect for email attachments, printing, or embedding in documents.
set -euo pipefail

# ─── Colors ────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'

info()  { echo -e "${CYAN}ℹ${NC} $*"; }
ok()    { echo -e "${GREEN}✓${NC} $*"; }
warn()  { echo -e "${YELLOW}⚠${NC} $*"; }
err()   { echo -e "${RED}✗${NC} $*" >&2; }

# ─── Parse flags ──────────────────────────────────────────

# Default resolution: 1920x1080 (full HD, ~1-2MB per slide)
# Compact resolution: 1280x720 (HD, ~50-70% smaller files)
VIEWPORT_W=1920
VIEWPORT_H=1080
COMPACT=false

POSITIONAL=()
for arg in "$@"; do
    case $arg in
        --compact)
            COMPACT=true
            VIEWPORT_W=1280
            VIEWPORT_H=720
            ;;
        *)

View on GitHub (pinned to 9906a34d64)

Solutions

  1. Re-run with correct arguments: bash scripts/export-pdf.sh ./deck/index.html [output.pdf] [--compact], verifying the HTML file exists at that path
  2. Install Node.js (brew install node or nodejs.org) if npx is missing
  3. If Playwright setup fails, run manually: npm install playwright && npx playwright install chromium (or npx playwright install-deps chromium on Linux for missing system libraries); check proxy/firewall if the browser download is blocked
  4. If 'PDF export failed.' is printed, ensure the HTML uses <div class="slide"> or <section class="slide"> elements — the script exits with 'No .slide elements found' otherwise
  5. Run the script from the project root or pass an absolute path to the HTML so the input-file check passes

Example fix

// before (wrong element structure → node script fails → err fires)
<div class="page">Slide 1</div>

// after (matches the exporter's selector)
<div class="slide">Slide 1</div>
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# Pre-flight checks before running export-pdf.sh
set -euo pipefail
HTML="$1"
[[ $# -ge 1 ]] || { echo "Usage: export-pdf.sh <html> [out.pdf] [--compact]" >&2; exit 1; }
[[ -f "$HTML" ]] || { echo "File not found: $HTML" >&2; exit 1; }
command -v npx >/dev/null || { echo "Node.js required" >&2; exit 1; }
grep -q 'class="slide"\|class=\x27slide\x27\|class="[^"]*\\bslide\\b' "$HTML" || \
  echo "WARNING: no .slide elements found — export will abort"
# Ensure Chromium can run (CI/minimal containers)
npx playwright install chromium --with-deps >/dev/null 2>&1 || \
  { echo "Playwright/Chromium not installed" >&2; exit 1; }

Type guard

is_exportable_deck() {
  local html="$1"
  [[ -f "$html" ]] && grep -Eq 'class="[^"]*\bslide\b[^"]*"' "$html"
}

Try / catch

# export-pdf.sh exits non-zero with err() on stderr; capture and branch
if ! bash scripts/export-pdf.sh "$HTML" "$OUT.pdf" 2>export.err; then
  cat export.err >&2
  case "$(cat export.err)" in
    *"No .slide elements"*) echo "Deck must use <div class=\"slide\"> elements" ;;
    *"Failed to install Chromium"*) npx playwright install-deps chromium ;;
    *"not installed"*) echo "Install Node.js first" ;;
  esac
  exit 1
fi

Prevention

When it happens

Trigger: Running export-pdf.sh with no arguments (usage error); passing an HTML path that does not exist (-f check at line 70); npx missing; 'npm install playwright' or 'npx playwright install chromium' failing (offline, npm registry blocked, missing system libs for Chromium); the node export-slides.mjs run failing — most commonly because the HTML contains zero '.slide' elements, or Playwright cannot launch a headless browser in the environment.

Common situations: First run on a machine behind a corporate proxy/firewall blocking the Chromium download; minimal Linux/CI containers missing Chromium shared-library dependencies (libnss3, libatk, etc.); pointing the script at an HTML file that doesn't use the expected <div class="slide"> structure; running from a different directory with a relative path to the HTML that doesn't resolve; disk or permission issues in the mktemp temp directory.

Related errors


AI-assisted analysis of zarazhangrui/frontend-slides@9906a34d64 (2026-08-29). Data as JSON: /api/errors/41373293b929abe5. Report an issue: GitHub.