エラーコードポータル
Node.jsNode.jsエラーコード

ERR_REQUIRE_CYCLE_MODULE

require cycle module

コード ERR_REQUIRE_CYCLE_MODULE · Node.jsが報告した問題です。

ES モジュールを require() しようとすると、CommonJS から ESM、または ESM から CommonJS エッジが即時サイクルに参加します。 ES モジュールがすでに評価されている間は評価できないため、これは許可されません。 サイクルを回避するには、サイクルに含まれる require() 呼び出しは、ES モジュール (createRequire() 経由) または CommonJS モジュールのトップレベルで発生すべきではなく、内部関数で遅延して実行される必要があります。

Google Translate · 自動翻訳です。専門用語や適用条件は英語の原文で確認してください。

When trying to require() an ES Module, a CommonJS to ESM or ESM to CommonJS edge participates in an immediate cycle. This is not allowed because ES Modules cannot be evaluated while they are already being evaluated. To avoid the cycle, the require() call involved in a cycle should not happen at the top-level of either an ES Module (via createRequire()) or a CommonJS module, and should be done lazily in an inner function.

トラブルシューティング・診断リンク

まず、文書の製品・バージョン・発生環境が現在の状況と一致しているか確認してください。