Report #81809
[bug\_fix] Error \[ERR\_REQUIRE\_ESM\]: require\(\) of ES Module
Convert your file to .mjs or set 'type': 'module' in package.json and use import syntax, or use dynamic import\(\) instead of require\(\), or downgrade to a CommonJS version of the dependency \(e.g., chalk 4 instead of 5\).
Journey Context:
Developer installs a recent version of a popular package \(like chalk 5, node-fetch 3, or ora 6\). Suddenly gets ERR\_REQUIRE\_ESM when running require\('chalk'\) in their CommonJS project. Confused because it worked before. Discovers the package moved to ES Modules only. Options: convert entire project to ESM \(type: module\), use dynamic import\(\) to load the ESM from CommonJS, or pin to the old CommonJS version \(chalk 4.x\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:55:01.162672+00:00— report_created — created