saadeghi/daisyui · error · Error

Chrome or Chromium was not found. Set TAILWIND_PLAY_BROWSER

Error message

Chrome or Chromium was not found. Set TAILWIND_PLAY_BROWSER or pass --browser <path>.

What it means

If no explicit browser is configured, findBrowser walks hardcoded per-platform candidates (macOS app paths, Linux binary names on PATH, Windows Program Files locations). If none resolves to an executable, it throws telling the user to set TAILWIND_PLAY_BROWSER or pass --browser.

Source

Thrown at packages/tailwind-play-share/index.mjs:250

      "chromium-browser",
      "microsoft-edge",
    ],
    win32: [
      process.env.LOCALAPPDATA &&
        join(process.env.LOCALAPPDATA, "Google", "Chrome", "Application", "chrome.exe"),
      process.env.PROGRAMFILES &&
        join(process.env.PROGRAMFILES, "Google", "Chrome", "Application", "chrome.exe"),
      process.env["PROGRAMFILES(X86)"] &&
        join(process.env["PROGRAMFILES(X86)"], "Google", "Chrome", "Application", "chrome.exe"),
    ].filter(Boolean),
  }

  for (const candidate of platformCandidates[process.platform] ?? []) {
    const executable = await resolveExecutable(candidate)
    if (executable) return executable
  }

  throw new Error(
    "Chrome or Chromium was not found. Set TAILWIND_PLAY_BROWSER or pass --browser <path>.",
  )
}

const delay = (milliseconds) =>
  new Promise((resolvePromise) => setTimeout(resolvePromise, milliseconds))

async function waitForDebuggingPort(profileDirectory, browserProcess, timeoutMs, getSpawnError) {
  const activePortFile = join(profileDirectory, "DevToolsActivePort")
  const deadline = Date.now() + timeoutMs

  while (Date.now() < deadline) {
    const spawnError = getSpawnError()
    if (spawnError) {
      throw new Error(`Could not start the browser: ${spawnError.message}`)
    }
    if (browserProcess.exitCode !== null) {
      throw new Error(`Browser exited before starting (exit code ${browserProcess.exitCode})`)

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Install Chrome or Chromium in a standard location.
  2. Set TAILWIND_PLAY_BROWSER (or CHROME_PATH) to the binary path.
  3. Pass --browser <path> explicitly for this run.

Example fix

# before (no chrome installed)
bun .../index.mjs --html '<div/>'
# after
apt-get install -y chromium \
  && TAILWIND_PLAY_BROWSER=/usr/bin/chromium bun .../index.mjs --html '<div/>'
Defensive patterns

Strategy: validation

Validate before calling

import { access, constants } from 'node:fs/promises'
async function hasAnyBrowser(candidates) {
  for (const c of candidates) { try { await access(c, constants.X_OK); return c } catch {} }
  return undefined
}

Try / catch

try {
  await createTailwindPlay({ html, css })
} catch (error) {
  if (/was not found/.test(error.message)) {
    // install a browser, then set TAILWIND_PLAY_BROWSER, then retry
  }
}

Prevention

When it happens

Trigger: Running on a machine/container without Chrome, Chromium, or Edge installed in any of the probed locations; PATH does not include the browser directory.

Common situations: Fresh CI runner (Alpine, slim Docker image); Linux server with Chrome installed under a non-standard prefix; headless container with only chromium-sandbox stripped.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/8b15344f3ed53eff. Report an issue: GitHub.