Report #6822
[bug\_fix] Error \[ERR\_REQUIRE\_ESM\]: require\(\) of ES Module not supported
Either downgrade to the last CommonJS version of the package \(e.g., [email protected]\), or convert your project to ESM by adding "type": "module" to package.json and using ES module syntax, or use dynamic import\(\) to load the ESM module asynchronously.
Journey Context:
Developer installs chalk@5 \(or any pure ESM package like got@12\) in an existing CommonJS project. Sees error when doing require\('chalk'\). Checks chalk docs, sees "ESM only". Tries using dynamic import\(\) but gets confused by async/await complexity in existing synchronous startup code. Looks at Node ESM docs, learns about .mjs extension or "type": "module" in package.json. Realizes entire project needs migration strategy or must stick to chalk@4 \(CJS version\). Debugging involves checking node\_modules/chalk/package.json for "type": "module" field and "exports" map.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:10:02.800914+00:00— report_created — created