After installing npm prompts, I encountered a strange issue. When trying to run the example code for npm prompts, I found that I couldn't enter any input at all. The underscore in the input field would blink for a few seconds, then the cursor would jump to the next line of the terminal and I wouldn't be able to click into the input field to type anything.
https://i.sstatic.net/H6e5r.png
https://i.sstatic.net/AUZix.png
I attempted running the code in both cmd and the VSC terminal. Here is the code snippet itself:
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'number',
name: 'value',
message: 'How old are you?',
validate: (value) => value < 18 ? `Nightclub is 18+ only` : true
});
console.log(response); // => { value : 24 }
})();
The only modification I made was adding the type 'number' to 'value'