(errorMessage: string)
| 326 | * isn't a shared-library/launch failure this module can help with. |
| 327 | */ |
| 328 | export function chromeLaunchRemediation(errorMessage: string): string | undefined { |
| 329 | const isLaunchFailure = |
| 330 | /Failed to launch the browser process/i.test(errorMessage) || |
| 331 | isSharedLibLaunchError(errorMessage); |
| 332 | if (!isLaunchFailure) return undefined; |
| 333 | if (process.platform !== "linux") return undefined; |
| 334 | // On Linux ARM64 the render browser is system Chromium (see |
| 335 | // ensureLinuxArmBrowser in manager.ts), so a launch failure there is almost |
| 336 | // always a missing/mis-pathed chromium — NOT the headless-shell .so set. The |
| 337 | // shared-lib install line would be wrong advice, so defer to that path's own |
| 338 | // guidance instead of emitting it here. |
| 339 | if (process.arch === "arm64") return undefined; |
| 340 | |
| 341 | const distro = detectLinuxDistro(); |
| 342 | const lines: string[] = []; |
| 343 | lines.push( |
| 344 | `Chrome could not launch on ${distroLabel(distro)} — this is almost always missing system libraries (e.g. libnss3).`, |
| 345 | ); |
| 346 | lines.push("Install the Chrome headless dependencies:"); |
| 347 | lines.push(` ${chromeDepsInstallCommand(distro.family)}`); |
| 348 | lines.push("Then verify with: npx hyperframes doctor"); |
| 349 | return lines.join("\n"); |
| 350 | } |
no test coverage detected