Skip to content

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

Description

@jake-lively

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions