Questions tagged [inquirerjs]

Use this tag for questions related to the Inquirer JavaScript package, which provides a command line interface for Node.js.

The Documentation section of the package's GitHub README provides examples of usage, as well as links to various plugins.

67 questions
0
votes
1 answer

How to test a function passed as parameter (validate, filter) to inquirer.prompt in Jest Unit Testing?

I'm trying to mock method inquirer.prompt in a unit testing, which has several questions (in the example I put only two examples). return prompt([ { type: 'input', name: 'name1', message: 'Question 1?', filter: (fieldValue: string)…
mardo
  • 581
  • 1
  • 7
  • 11
0
votes
1 answer

Module Error using Inquirer in an OpenCLI Command

Using the example code here: https://oclif.io/docs/prompting I'm trying to implement a prompt in an OpenCLI command using Inquirer. When I load the module as described in the example on that page: import * as inquirer from 'inquirer'; and run the…
johnwargo
  • 601
  • 2
  • 7
  • 22
0
votes
1 answer

InquirerJS problems

Writting a program using javascript and inquirerJS to ask question and play game, if dont want to play ok end game, if want to play more( ask for guessed number and show computer generated number greet if correct else better luck next time) I tried…
no iam
  • 1
  • 2
0
votes
0 answers

How can I break out of question loop on ENTER using inquirer.js?

I have the following task: To terminate the procedure for adding users, it is enough to press ENTER instead of entering a name. But when I use when in my code, the question is not displayed even the first time. Help me, please. const questions = [ …
0
votes
1 answer

How to properly nest inquirer prompts?

Summary I'm working on a project for school that requires us to use Inquirer to help users navigate an SQL database. I've boiled down my question to a minimum example. Basically, my main init() function continuously loops through an Inquirer prompt…
JShoe
  • 3,186
  • 9
  • 38
  • 61
0
votes
0 answers

Why Node.js CLI app hangs after completion till break with Ctrl-C?

I've a simple Node.js command line program that uses commander and inquirer for taking command line inputs. It then connects to MongoDB Atlas to carryout its operations in index.js file, and after connection to DB is closed, it just hangs there till…
SJaka
  • 712
  • 13
  • 40
0
votes
1 answer

Inquirer exits before I am able to make a choice in node js

I am attempting to write a command line app that uses inquirer to display and eventually update a mysql database. My db files appear to be in order when I use the mysql shell, however I appear to run into an issue when I attempt to connect to my db…
aaburz
  • 1
  • 1
0
votes
1 answer

NPM CLI returns command not found

I have created a simple CLI to bootstrap projects with inquirer and have successfully published it to NPM. However, when installing it with npm i -g noobject it's successfully loading and installing. When running noobject in the cmd line, it does…
user18197344
0
votes
0 answers

Javascript Inquirer (npm package) promt quits with exit code one only in one place in the program

I tried to make a simple cli nodejs game, with inquirer to ask for player input - name and question answers. I wrote the following code, which works as expected: async function askName() { playerName = (await inquirer.prompt({ name:…
0
votes
1 answer

Using inquirer js inside a loop is not waiting for user input

I have an array of changes to apply to the database and for every change I need user confirmation. Therefore I'm using inquirer js to ask the user if he wants to apply those changes. I tried outside the loop and works but if I do it inside the loop…
jcobo1
  • 1,065
  • 1
  • 18
  • 34
0
votes
1 answer

Options in inquirer.js javascript inputs

Instead of using a bunch of ifs, is there a way to show different options for different selections rather than having to specify directly for each one like I am doing? I think there is the .when option, but I am not really sure how to use it in this…
Reece
  • 1
  • 3
0
votes
1 answer

Problems with exiting from CLI

I've created simple CLI using inquirer and child_process. And i have problem, when i'am closing process with CTLR+C, it seems like its still running process, because terminal not responding anything. And i have to close terminal every time and open…
0
votes
1 answer

Why are multiple inquirer prompts running concurrently even outside of the method they are in?

I am attempting to create a command line interface that prompts users to enter or retrieve data from a database. So far the only methods I have written are for the info needed from the user to create new database rows. However when one of the…
0
votes
1 answer

Keep repeating the prompter questions with Inquirer.js based on answer?

I'm using Inquirer.js to create a CLI's prompter which allows users to enter/reply to some input/questions. In the last question, I want to add a feature that if the user replies no to Are you done? question, then the prompter will restart asking…
0
votes
0 answers

Unable to install modules through npm. No proxy used

Every time I try to install inquirer and commander in a certain folder (a GitHub repo for a course on frontend masters). I tend to get these errors every time I try to do so. npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! errno…
Zawedcvg
  • 21
  • 4