-
Notifications
You must be signed in to change notification settings - Fork 41
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
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported. #159
Comments
Short version: Are you using yarn 1? Try upgrading to yarn v1.22.22 or higher. Long version The problem isn't actually in this repo. Or at least, not yet. PR #139 uses package aliases to pull in two different versions of string-width et al to add wrapping support for esm. It is published as @isaacs/cliui from a cliui fork and is used as a dependency of JackSpeak. The aliases can trigger broken dependency resolution with Yarn 1. |
With a closer look I realized the problem might not be this package because I got the same issue with another. I was in fact using yarn 1.22.19. Thanks for the tip! |
...that causes `yarn install` to fail. Ref: - isaacs/jackspeak#5 - yargs/cliui#159
i use yarn in version 1.22.22 and the problem still persists |
Have you got a reproduction @achimstraussdmb2bcom ? |
I was struggling with this issue, I'm not 100% sure what solved it but in the end I got it working on |
I had the same issue, updating to yarn 1.22.22 and this fixed it:
|
I've just updated to 1.22.22 and it was enough to solve the issue, I was facing this ERR_REQUIRE_ESM on Vite + React +Jest setup |
We use cliui transitively through jest, which is a CJS module. Currently, when running
jest
in our project, we get the following error:I believe this is because of these lines.
Instead
string-width
andstring-ansi
,string-width-cjs' and
string-ansi-cjsshould be required. Those are already installed. However, the third dependency
wrap-ansi` does not exist as a CJS dependency.The text was updated successfully, but these errors were encountered: