Report #9477
[bug\_fix] Error \[ERR\_REQUIRE\_ESM\]: require\(\) of ES Module ... from ... is not supported
Convert your project to ESM by adding "type": "module" to package.json and using import/export syntax, or use dynamic import\(\) instead of require\(\) for the specific ESM package, or downgrade to the last CommonJS version of the package \(e.g., chalk v4 instead of v5\).
Journey Context:
You upgrade a dependency like chalk to v5, got to v12, or node-fetch to v3. Suddenly your require\('chalk'\) throws ERR\_REQUIRE\_ESM. You check the package documentation and see it became pure ESM. You try renaming your file to .mjs but that breaks other CommonJS requires. You read the Node.js documentation on ESM and realize you have three options: 1\) Convert your entire project to ESM by adding "type": "module" to package.json and changing all requires to imports, 2\) Keep your project CommonJS but use dynamic import\('chalk'\) which returns a Promise resolving to the module, 3\) Downgrade to chalk v4 which supports CommonJS. You choose based on your project constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:16:27.787351+00:00— report_created — created