Error AtlasError Documentation and Resolution

Node.js require cannot load an asynchronous ES module

Error [ERR_REQUIRE_ASYNC_MODULE]: require() cannot be used on an ESM graph with top-level await

Synchronous require cannot load an ES module graph that uses top-level await. The awaited work may be in a dependency rather than the module named by the caller.

ERR_REQUIRE_ASYNC_MODULEmodules
Error [ERR_REQUIRE_ASYNC_MODULE]: require() cannot be used on an ESM graph with top-level await
  • A CommonJS caller requires an ES module containing top-level await.
  • An indirect dependency introduces top-level await into the module graph.
  1. Inspect the require call and dependency graph. On supported Node versions, --experimental-print-required-tla can help locate top-level await; use it in a controlled development run because module code may execute during diagnosis.
  2. Replace the synchronous require with dynamic import and await the result within an async initialization path. Update callers to wait for initialization.
  3. If the caller must remain synchronous, use a documented synchronous package entry point or choose a compatible dependency version. Do not assume renaming a file removes asynchronous module behavior.
  4. Check the target Node version: modern Node can require synchronous ES modules, but top-level await still requires asynchronous loading.
Node.js Docs: ERR_REQUIRE_ASYNC_MODULE