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

v5 breaks yarn install when it is used indirectly by lerna #51

Closed
svitovyda opened this issue May 30, 2023 · 6 comments
Closed

v5 breaks yarn install when it is used indirectly by lerna #51

svitovyda opened this issue May 30, 2023 · 6 comments

Comments

@svitovyda
Copy link

I already posted a bug in wide-align, but maybe you can add a backwards compatibility too:

Your library is used by wide-align, which is used by gauge, which is used by npmlog <- @npmcli/arborist <- lerna.
And a simple yarn upgrade on my project now fails to do yarn install with:

[5/5] 🔨  Building fresh packages...
.../node_modules/wide-align/align.js:2
var stringWidth = require('string-width')
                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/string-width/index.js from .../node_modules/wide-align/align.js not supported.
Instead change the require of index.js in .../node_modules/wide-align/align.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (.../node_modules/wide-align/align.js:2:19)
    at Object.<anonymous> (.../node_modules/gauge/lib/render-template.js:2:13)
    at Object.<anonymous> (.../node_modules/gauge/lib/plumbing.js:3:22)
    at Object.<anonymous> (.../node_modules/gauge/lib/index.js:2:16)
    at Object.<anonymous> (.../node_modules/npmlog/lib/log.js:3:13)
    at libs/core/src/lib/collect-uncommitted.ts (.../node_modules/lerna/dist/cli.js:48:29)
    at __init (.../node_modules/lerna/dist/cli.js:11:56)
    at libs/core/src/lib/check-working-tree.ts (.../node_modules/lerna/dist/cli.js:163:5)
    at __init (.../node_modules/lerna/dist/cli.js:11:56)
    at libs/core/src/index.ts (.../node_modules/lerna/dist/cli.js:4516:5)
    at __init (.../node_modules/lerna/dist/cli.js:11:56)
    at packages/lerna/src/index.ts (.../node_modules/lerna/dist/cli.js:9511:5)
    at __require (.../node_modules/lerna/dist/cli.js:14:50)
    at Object.<anonymous> (.../node_modules/lerna/dist/cli.js:9545:3) {
  code: 'ERR_REQUIRE_ESM'
@sindresorhus
Copy link
Owner

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2023
@svitovyda
Copy link
Author

tbh not very nice to comment me this link, as I'm not a developer who uses your lib directly and cannot fix anything in that tree, except hardcoding versions of indirect libs in resolutions. Like I said, I just did a yarn upgrade in my project, that simply uses lerna, and got blocked for the half of the day by having to investigate all the hidden dependencies

@leolima
Copy link

leolima commented Jul 28, 2023

why this thread is closed? it still broken.

@ivanpondal
Copy link

just encountered the same error by updating jest. is there another fix besides hardcoding a newer version?

@leolima
Copy link

leolima commented Aug 24, 2023

🙌 i'm solved upgrading yarn version to 3.6.1

yarn set version 3.6.1

@qfdk
Copy link

qfdk commented Jun 3, 2024

Hello all,

I found a solution and would like to share how to resolve it (1.22.22):

  1. Don;t need to delete yarn.lock
  2. Run yarn why string-width to find the library that uses it as a dependency.
  3. Downgrade this library to the version that works, remove node_modules, and then run yarn install to verify it works.
  4. Use yarn upgrade lib@version to upgrade only this library.

It should work.

Happy coding!

2024-06-03

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

No branches or pull requests

5 participants