Error AtlasError Documentation and Resolution

Node.js require tried to load an ES module

Error [ERR_REQUIRE_ESM]: require() of ES Module not supported

Node.js rejected a require() call because the target module is an ES module and the current loading path is not compatible with it.

ERR_REQUIRE_ESMmodules
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
  • CommonJS code is trying to load an ES module with require().
  • A dependency changed from CommonJS to ESM and the caller code still uses require().
  • The project mixes module systems without an intentional interop strategy.
  1. Switch to import syntax where the surrounding module format supports it.
  2. Use a compatible package version or entry point if the current dependency format is incompatible.
  3. Review package type, file extensions, and runtime module settings so CommonJS and ESM boundaries are explicit.
Node.js Errors: ERR_REQUIRE_ESM
Node.js ERR_REQUIRE_ESM: causes and fixes | Error Atlas