SBoudrias/Inquirer.js

Input error at isEnterKey

Eric-South opened this issue · 6 comments

I am trying to integrate Inquirer into a CLI project, and am unable to get the most basic of examples working.
Node version is 14.19.0. Running this in windows.
I've set up inquirer in an empty project with the following steps:
npm init
npm install @inquirer/prompts
update package.json with "type": "module"
npm run index.js with the following contents:

import { input } from '@inquirer/prompts';

const name = await input({ message: 'Enter your name' });

and receive the following error every time a key is pressed.

Enter your name  (node:10196) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
    at isEnterKey

I've tried multiple terminals and can't seem to get this to work.

Hi, I'll need more information to be able tom help since I'm unable to reproduce it.

Did you try running npx @inquirer/demo@latest - do you see the same issue when running the input prompt demo?

  • Which version of @inquirer/prompts are you using? Did you try latest?
  • What's your Windows' version?
  • What's the terminals you tried this on?

I didn't specify a version for @inquirer/prompts, it is currently at 3.1.1.
This is on Windows 10.
I tried using cmder bash terminal, windows command prompt, and git bash, all with the same result.

I just tried npx @inquirer/demo@latest in powershell and get a similar result when I try to arrow key up or down.
image

I meet too

I use mac termial run npx @inquirer/demo@latest,meet the same error

I use mac termial run npx @inquirer/demo@latest,meet the same error

nodejs v14 meet the error, but node v16 not meet the error

Oh... I see. I can reproduce with Node 14.

Do note that Node 14 and 16 are both EOL. As such, we're not maintaining backward compatibility with either.

If you cannot update to an LTS version of Node (and you really, really, should), then the only solution is to rely on old versions on Inquirer released while the version you used were still in LTS status.

Since Node 14 went EOL in April, do note no version of @inquirer/prompts will officially support it since that package was release after. In which case you'd fallback to the inquirer package; around 9.1.0.