Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JakeCB opened this issue Sep 9, 2022 · 0 comments

Comments

@JakeCB
Copy link

JakeCB commented Sep 9, 2022

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.

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

No branches or pull requests

1 participant