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

Dynamic require of "enquirer" is not supported #631

Closed
queengooborg opened this issue Feb 3, 2022 · 3 comments · Fixed by #656 · May be fixed by X-oss-byte/next.js#1384
Closed

Dynamic require of "enquirer" is not supported #631

queengooborg opened this issue Feb 3, 2022 · 3 comments · Fixed by #656 · May be fixed by X-oss-byte/next.js#1384
Labels
bug Something isn't working easy this should ideally be an easy fix released

Comments

@queengooborg
Copy link

queengooborg commented Feb 3, 2022

In a recent update to listr2 (or enquirer), I had noticed that task.prompt would now crash with an error saying that "Enquirer is a peer dependency that must be installed separately." This error had confused me, however, as I definitely had Enquirer installed. Instead, I did a bit of debugging to figure out what exactly the underlying error was, and found that there was an error dynamically importing Enquirer.

I have a feeling this might have come from the recent v4 release, where ESM support was added, especially since our project is using ESM. We're temporarily solving this by calling enquire.prompt directly, but this seems to cause some rendering issues, so it's only a temporary fix.

@cenk1cenk2
Copy link
Collaborator

Hey @queengooborg ,

Thanks for the heads up. If this is a problem with ESM, I will check it in a mock ESM package. I guess I currently only use the cjs part of it.

You can just use the injectWrapper.enquirer key to pass it in for now, which should pass your created instance of enquirer and pipe it through the renderer. Else as you said it would cause rendering problems since two things are trying to hook up to the stdout to gain control.

@alopix
Copy link
Contributor

alopix commented Apr 5, 2022

Just encountered the same issue and can confirm that it seems to be an issue when using ESM (since it worked before, when using CJS). Your suggestion with the listr options injectWrapper.enquirer works, thanks.

XadillaX added a commit to XadillaX/node-core-utils that referenced this issue Jun 6, 2022
@cenk1cenk2 cenk1cenk2 added bug Something isn't working easy this should ideally be an easy fix labels Jun 9, 2022
targos pushed a commit to nodejs/node-core-utils that referenced this issue Jun 22, 2022
cenk1cenk2 added a commit that referenced this issue Sep 5, 2022
cenk1cenk2 added a commit that referenced this issue Sep 5, 2022
…mport

fix: esm dynamic import of enquirer
cenk1cenk2 pushed a commit that referenced this issue Sep 5, 2022
## [5.0.5](v5.0.4...v5.0.5) (2022-09-05)

### Bug Fixes

* esm dynamic import of enquirer ([55bed0a](55bed0a)), closes [#631](#631)
@cenk1cenk2
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

johnfrench3 pushed a commit to johnfrench3/core-utils-node that referenced this issue Nov 2, 2022
renawolford6 added a commit to renawolford6/node-dev-build-core-utils that referenced this issue Nov 10, 2022
Developerarif2 pushed a commit to Developerarif2/node-core-utils that referenced this issue Jan 27, 2023
gerkai added a commit to gerkai/node-core-utils-project-build that referenced this issue Jan 27, 2023
shovon58 pushed a commit to shovon58/node-core-utils that referenced this issue Jun 9, 2023
patrickm68 added a commit to patrickm68/NodeJS-core-utils that referenced this issue Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy this should ideally be an easy fix released
Projects
None yet
3 participants