ruyadorno / ntl

Node Task List: Interactive cli to list and run package.json scripts
https://www.npmjs.com/package/ntl
MIT License
932 stars 35 forks source link

Error ERR_REQUIRE_ESM when using it with inquirer@v9 #88

Open DerZyklop opened 5 months ago

DerZyklop commented 5 months ago

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:

Hope this helps.

DerZyklop commented 5 months ago

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?