SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.26k stars 1.31k forks source link

Possible bug on using inquirer inside of commitlint #1460

Closed devmozao closed 4 months ago

devmozao commented 4 months ago

is this related to something that may have changed on Inquirer.js?

node:internal/modules/esm/resolve:299
  return new ERR_PACKAGE_PATH_NOT_EXPORTED(
         ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/prompts/input.js' is not defined by "exports" in /home/devmozao/makasi/app/node_modules/inquirer/package.json imported from /home/devmozao/makasi/app/node_modules/@commitlint/prompt/lib/inquirer/InputCustomPrompt.js
    at exportsNotFound (node:internal/modules/esm/resolve:299:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:646:9)
    at packageResolve (node:internal/modules/esm/resolve:825:14)
    at moduleResolve (node:internal/modules/esm/resolve:915:18)
    at defaultResolve (node:internal/modules/esm/resolve:1120:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:526:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:126:49) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v22.4.0

I'm not the maintainer of commitlint, but I do use their solution on some of the things I do, and recently this week (begin of july 2024), we started receiving this error, being on node v22, node v20 and also bun v1.1.8.

It used to work as a charm before, for like, past 2 years, at least. I'm asking here cuz I wasn't able to get an answer on commitlint repo itself atm.

SBoudrias commented 4 months ago

Ahh yes, the library seems to rely on internals... They should move to @inquirer/input or a custom prompt with @inquirer/core.

There's a bit more on fixing this on #1456