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

Error ERR_REQUIRE_ESM when using it with inquirer@v9 #88

Open
DerZyklop opened this issue Apr 29, 2024 · 1 comment
Open

Error ERR_REQUIRE_ESM when using it with inquirer@v9 #88

DerZyklop opened this issue Apr 29, 2024 · 1 comment

Comments

@DerZyklop
Copy link

I recently got this error when trying to run npx ntl --autocomplete:

/[project path]/node_modules/inquirer-autocomplete-prompt-ipt/index.js:10
var Base = require('inquirer/lib/prompts/base');
           ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /[project path]/node_modules/inquirer/lib/prompts/base.js from /[project path]/node_modules/inquirer-autocomplete-prompt-ipt/index.js not supported.
Instead change the require of base.js in /[project path]/node_modules/inquirer-autocomplete-prompt-ipt/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/[project path]/node_modules/inquirer-autocomplete-prompt-ipt/index.js:10:12) {
  code: 'ERR_REQUIRE_ESM'
}

I tried to debug without knowing much about the internals of ntl, and figured out:

  • It’s not a problem when I run the globally installed ntl, its only a problem when ntl is installed in my project folder.
  • It's not a problem when I add "inquirer": "8" to my package.json. Otherwise version 9 would be installed/used.

Hope this helps.

@DerZyklop
Copy link
Author

PS: I got these errors without any updates to my package.json. So I believe there is some dependency in the chain which should be defined more precisely.

As this repo does not have a direct dependency to inquirer, it might be an issue of ipt (which uses inquirer internally) instead of ntl?

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

1 participant