santifer/career-ops · error · Error

--verify requires Playwright with Chromium (run "npx…

Error message

--verify requires Playwright with Chromium (run "npx playwright install chromium"): ${err.message}

What it means

scan.mjs's --verify path dynamically imports playwright and liveness-browser.mjs; when that import throws, the library wraps it in this error to say Chromium support is required. The original failure is preserved as `cause`.

Solutions

  1. Run `npx playwright install chromium`
  2. Install the dependency: `npm install playwright` (project-local, not global-only)
  3. Verify `node -e "import('playwright')"` resolves without error
  4. Re-run without --verify to skip browser-based verification

Example fix

// before
node scan.mjs --verify          # Error: --verify requires Playwright with Chromium
// after
npm install playwright && npx playwright install chromium
node scan.mjs --verify
Defensive patterns

Strategy: fallback

Validate before calling

async function canVerify() {
  try { await import('playwright'); return true; } catch { return false; }
}
const args = canVerify() ? ['--verify'] : [];

Try / catch

try {
  await scanWithVerify(opts);
} catch (err) {
  if (err.message.includes('--verify requires Playwright')) {
    console.warn('Falling back to scan without --verify:', err.cause?.message);
    return scanWithoutVerify(opts);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running the scanner with --verify when the playwright package cannot be resolved (not installed) or liveness-browser.mjs cannot be loaded, or the playwright package loads but fails at import time due to version incompatibility.

Common situations: New environment where `npx playwright install chromium` was skipped; node_modules pruned; running via npx from a directory without playwright installed; Node runtime mismatch with the Playwright install.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16). Data as JSON: /api/errors/ea6aca56610ad13c. Report an issue: GitHub.

Appendix: source

Thrown at scan.mjs:2691

  return results;
}

// ── Main ────────────────────────────────────────────────────────────

async function verifyOffers(offers, { headedFallback = false, throttleBaseMs = 0, rediscover = false } = {}) {
  // Dynamic imports keep the default zero-token path free of Playwright startup
  let chromium;
  let checkUrlLiveness;
  let checkUrlLivenessWithFallback;
  let createHeadedPageProvider;
  let newLivenessPage;
  let jitteredDelayMs;
  let sleep;
  try {
    ({ chromium } = await import('playwright'));
    ({ checkUrlLiveness, checkUrlLivenessWithFallback, createHeadedPageProvider, newLivenessPage, jitteredDelayMs, sleep } = await import('./liveness-browser.mjs'));
  } catch (err) {
    throw new Error(
      `--verify requires Playwright with Chromium (run "npx playwright install chromium"): ${err.message}`,
      { cause: err },
    );
  }

  let browser;
  try {
    browser = await chromium.launch({ headless: true });
  } catch (err) {
    throw new Error(
      `--verify could not launch Chromium (run "npx playwright install chromium" or re-run without --verify): ${err.message}`,
      { cause: err },
    );
  }

  // Three permanent buckets + one transient passthrough:
  //   verified  → active pages and transient nav errors (retry next scan)
  //   expired   → classifier-confirmed dead postings (HTTP 4xx, redirect markers,

View on GitHub (pinned to e7abd431fc)