Report #98655
[bug\_fix] node ERR\_REQUIRE\_ESM require\(\) of ES Module not supported
If you control the package, add \`"type": "module"\` to package.json and use ES module syntax. If you are consuming an ESM-only package from CommonJS, replace \`const pkg = require\('pkg'\)\` with \`const pkg = await import\('pkg'\)\` \(dynamic import returns a Promise\). Do not try to \`require\(\)\` an ESM-only package; Node.js explicitly rejects it.
Journey Context:
You install a shiny new utility like \`chalk@5\` or \`node-fetch@3\` and immediately write \`const chalk = require\('chalk'\)\`. Node crashes with \`ERR\_REQUIRE\_ESM\`. You check the package's README and see it is now ESM-only. You try downgrading to the previous major version, which works but leaves you on old code. Then you rewrite the import to \`const chalk = await import\('chalk'\)\` inside an async function, or convert your own file to ESM with \`"type": "module"\` and \`import chalk from 'chalk'\`. The error disappears because Node now sees compatible module systems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:33:24.816387+00:00— report_created — created