require('supports-color') will always fail, supports-color version 9+ for node

オープン
#912 コメント 0 件 リアクション 28 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, node.js
領域
backend, devtools

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
11.5k
フォーク
992
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

debug-js/debug のほかの issue

debug-js/debug の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。