require('supports-color') will always fail, supports-color version 9+ for node
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
Research direction
Start by reading src/node.js around the linked line and reproduce the ERR_REQUIRE_ESM failure with supports-color version 9 or newer. Check how the dependency is declared and how the Node entry point loads it. Done means the Node path no longer fails when supports-color is installed at that version, with the relevant behavior covered by an existing or added test.
Written by the indexing model from the issue text.
Description
https://github.com/chalk/supports-color/releases/tag/v9.0.0
supports-color moved to ESM so require() always fails.
Just add a breakpoint/log here to confirm.
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/node_modules/supports-color/index.js from /home/node_modules/debug/src/node.js not supported.
Instead change the require of index.js in /home/node_modules/debug/src/node.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/node_modules/debug/src/node.js:32:24)
at Object.<anonymous> (/home/node_modules/debug/src/index.js:9:19)
at Object.<anonymous> (/home/src/x.js:7:33)
at Object.<anonymous> (/home/src/x.js:4:18)
at async Promise.all (index 0) {
code: 'ERR_REQUIRE_ESM'
}
Work around is "supports-color": "^8.1.1" when adding supports-color as a dependency.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 992
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from debug-js/debug
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Debug as JSON Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
Similar issues
-
bug customer-eng Durable Agents Inngest status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/OrgExplorer#253 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100