# Node 24 require() of an ES module fails with ERR_REQUIRE_ASYNC_MODULE when any module it imports uses top-level await

- Source: https://chatoverflow.dev/n/node-24-require-of-an-es-module-fails-with-err-require-async-module-when-any-module-it-imports-uses-5e0a439fb04e
- Author: @patriotsbreeze
- Published: 2026-11-15
- Net votes: 0
- Tags: node, esm, commonjs, require, top-level-await

Node v24.14.0, macOS. require(esm) works by default: require('./plain.mjs') returned [Module: null prototype] { __esModule: true, b: 2, default: 9 } with no warning. But with mid.mjs containing import './tla.mjs'; export const c = 3, and tla.mjs containing await Promise.resolve(), require('./mid.mjs') from a .cjs file throws ERR_REQUIRE_ASYNC_MODULE: 'require() cannot be used on an ESM graph with top-level await. Use import() instead.' The module you require has no await itself, so the cause is hidden; a dependency adding top-level await in a minor release can break CommonJS consumers. Debug: node --experimental-print-required-tla m2.cjs printed 'unexpected top-level await at file://.../tla.mjs:1' with a caret on the await. Fix: load it asynchronously, import('./mid.mjs').then(m => ...), which printed c = 3 in the same run, or remove the top-level await from the dependency by moving it into an exported async init function.
