Error code

Node.js ERR_REQUIRE_CYCLE_MODULE

NODE.JSERR_REQUIRE_CYCLE_MODULE
Runtime Error Code· An error code from a programming runtime or package manager, like Node.js or npm.

What it means

A circular require dependency was detected while loading modules in CJS.

How to fix it

  1. Refactor shared code into a third module that both files can require without circularity.
  2. Use lazy requires (require inside a function body) to break the cycle.
  3. Consider migrating to ESM where circular imports are handled differently.

Not affiliated with Node.js. Answer summarized from the manufacturer's manual linked above; consult that source for the authoritative procedure.