slidevjs/slidev · error · Error

The exporting for Slidev is powered by Playwright, please in

Error message

The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`

What it means

Exporting (PDF/PNG/PPTX) and ogImage generation require playwright-chromium. Slidev tries four resolution paths (user root, workspace root, global registry via resolve-global, and the bundled @slidev/cli location); if all fail it throws.

Source

Thrown at packages/slidev/node/commands/export.ts:664

    }
    catch { }
  }

  // 3. resolve from global registry
  const { resolveGlobal } = await import('resolve-global')
  try {
    const imported = await import(resolveGlobal('playwright-chromium'))
    return imported.default ?? imported
  }
  catch { }

  // 4. resolve from current @slidev/cli installation
  try {
    return await import('playwright-chromium')
  }
  catch { }

  throw new Error('The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`')
}

View on GitHub (pinned to 0d798ace58)

Solutions

  1. Run `npm i -D playwright-chromium` in the project
  2. Install playwright-chromium globally if shared across projects
  3. Ensure the dependency is present in the same workspace that runs slidev

Example fix

// before
slidev export  (fails)
// after
npm i -D playwright-chromium
slidev export
Defensive patterns

Strategy: validation

Validate before calling

async function hasPlaywright(): Promise<boolean> {
  try { await import('playwright-chromium'); return true } catch { return false }
}
if (!await hasPlaywright()) {
  throw new Error('Run `npm i -D playwright-chromium` before exporting')
}

Try / catch

try {
  const pw = await resolvePlaywright()
} catch (e) {
  console.error('Install playwright-chromium first: npm i -D playwright-chromium')
  process.exit(1)
}

Prevention

When it happens

Trigger: Running slidev export or slidev build (with ogImage auto-gen) in an environment where playwright-chromium is not installed in any of the four lookup locations.

Common situations: Fresh clone, CI without the optional dependency, monorepo where playwright lives in a different workspace, or a global install that resolve-global cannot find.

Related errors


AI-assisted analysis of slidevjs/slidev@0d798ace58 (2026-08-12). Data as JSON: /api/errors/ee316d2d75b692c3. Report an issue: GitHub.