Skip to content

Node 20 incompatibility with Lighthouse v12+ / shaka-bench #6

Description

@rameziophobia

The description below is AI generated, tl;dr is that shakacode/shakaperf-old#1 is fixed and shakacode/shakaperf-old#2 is still an issue
for the time being I have just added an nvm use step in integration tests to avoid using node 20 in shakacode/shakaperf-old#95

Node 20 incompatibility with Lighthouse v12+ / shaka-bench

Problem

Running shaka-bench compare fails under Node 20 due to two separate issues:

1. ERR_REQUIRE_ESM — Lighthouse v12+ is ESM-only

Lighthouse v12 ships as a pure ES Module. Our compiled CommonJS output uses require() to import it, which Node rejects:

Error: require() of ES Module .../lighthouse/core/index.js
from .../shaka-bench/dist/core/create-lighthouse-benchmark.js not supported.

2. V8 GC crash — concurrent_marking_handle_ assertion failure

Even after fixing the import, Node 20 (tested on v20.18.0 and v20.20.1) crashes with a fatal V8 garbage collector error during Lighthouse runs:

Fatal error in , line 0
Check failed: concurrent_marking_handle_ implies !concurrent_marking_handle_->IsValid().

This is a known V8 bug in the cppgc concurrent marker, triggered when dynamic ESM imports run alongside heavy workloads (Lighthouse + Chrome). The bug persists across the entire Node 20.x line.

Fixed in shakacode/shakaperf-old#95

  • ESM import fix (create-lighthouse-benchmark.ts, run-lighthouse.ts): Changed top-level require()-style imports of lighthouse to dynamic await import('lighthouse'), which works from CommonJS in all Node versions.
  • Node version enforcement (run-integration-tests-and-compare-logs.sh): The script now reads .nvmrc and automatically runs nvm use if the active Node version doesn't match, preventing tests from silently running on the wrong version.

Remaining

  • .nvmrc is set to Node 24.13.0 — this sidesteps the V8 GC crash entirely, but we should verify that all packages in the monorepo work correctly on Node 24.
  • CI may need updating — ensure CI environments also use the .nvmrc version when running integration tests.
  • The --no-concurrent-marking workaround could be used if Node 20 support is needed, but this is a band-aid and not recommended long-term.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions