* On Linux ARM64, attempt to auto-install system Chromium if not found. * This makes `hyperframes render` work out-of-the-box on DGX Spark / GB10 / Jetson.
(options?: EnsureBrowserOptions)
| 303 | * This makes `hyperframes render` work out-of-the-box on DGX Spark / GB10 / Jetson. |
| 304 | */ |
| 305 | async function ensureLinuxArmBrowser(options?: EnsureBrowserOptions): Promise<BrowserResult> { |
| 306 | void options; |
| 307 | |
| 308 | // If already available (env var or system path), use it directly. |
| 309 | const existing = await findBrowser(); |
| 310 | if (existing) return existing; |
| 311 | |
| 312 | // Try auto-installing via apt (common on Ubuntu-based ARM systems). |
| 313 | const hasApt = existsSync("/usr/bin/apt-get"); |
| 314 | if (hasApt) { |
| 315 | console.error( |
| 316 | "\n🔍 Linux ARM64 detected — Chrome Headless Shell is not available for this platform.", |
| 317 | ); |
| 318 | console.error("📦 Auto-installing system Chromium via apt-get (this only happens once)...\n"); |
| 319 | |
| 320 | // Use spawnSync so output streams to the terminal in real time. |
| 321 | const result = spawnSync("apt-get", ["install", "-y", "chromium-browser"], { |
| 322 | stdio: "inherit", |
| 323 | timeout: 120_000, |
| 324 | }); |
| 325 | |
| 326 | if (result.status === 0) { |
| 327 | const afterInstall = await findBrowser(); |
| 328 | if (afterInstall) { |
| 329 | console.error(`\n✅ Chromium installed at ${afterInstall.executablePath}\n`); |
| 330 | return afterInstall; |
| 331 | } |
| 332 | } else { |
| 333 | // apt succeeded but binary not found, or apt failed — fall through to helpful error. |
| 334 | console.error("\n⚠️ apt-get exited with errors. Trying anyway...\n"); |
| 335 | const afterAttempt = await findBrowser(); |
| 336 | if (afterAttempt) return afterAttempt; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | // Could not auto-install — give clear manual instructions. |
| 341 | throw new Error( |
| 342 | `Chrome Headless Shell is not available for Linux ARM64 (DGX Spark, GB10, Jetson).\n\n` + |
| 343 | `Install Chromium manually and point hyperframes to it:\n\n` + |
| 344 | ` sudo apt-get install -y chromium-browser\n` + |
| 345 | ` export HYPERFRAMES_BROWSER_PATH=$(which chromium-browser)\n\n` + |
| 346 | `Then re-run your command. The HYPERFRAMES_BROWSER_PATH env var persists for the session.`, |
| 347 | ); |
| 348 | } |
| 349 | |
| 350 | /** |
| 351 | * Find or download a browser. |
no test coverage detected