Questions tagged [inquirerjs]

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

inquirerjs
Filter by
Sorted by
Tagged with
0 votes
0 answers
29 views

Inquirer prompt

When running the demo script from Node.js's inquirer library the prompt on my terminal appears twice while I would like it to appear only once. Here is my script: import inquirer from "inquirer&...
F.I.'s user avatar
  • 13
0 votes
0 answers
14 views

I want to change the command I gave in the bin in package,json when using inquirer

This is the relevant my package.json file.I want to change this 'ruvw' into 'start'. "bin": { "ruvw": "./bin/index.js" }, "author": "", &...
Ruwini Shashikala's user avatar
0 votes
0 answers
36 views

Inquirer prompt() to returns name instead of value

const { selectedTodolistId } = await inquirer.createPromptModule()([ { type: 'list', name: 'selectedTodolistId', message: 'Select Proofhub Todolist:', choices: ...
Austin Jacob's user avatar
0 votes
0 answers
69 views

Why is my Node script not updating the files after the questions are answered?

I am writing a Node.js script that clones a GitHub repository and then prompts the user with questions. With those answers, it should go through the files and replace the respective placeholder values ...
WPdev11's user avatar
  • 59
0 votes
0 answers
89 views

Why is the terminal in an infinite loop with the prompts?

In relation to my previous question: Why is Node.js throwing an error to my require() statement? I added type: module to my packages.json and the code works and asks the questions. However, it keep ...
WPdev11's user avatar
  • 59
0 votes
0 answers
63 views

Lerna is not rendering inquirer prompt properly

I am using lerna to handle the monorepo project structure. When I run below code const question = [{ type: 'input', name: 'permission', message: chalk.red(logMessages....
Amit Limbasiya's user avatar
0 votes
0 answers
64 views

How to return an index of each given answer as a result in multiselect prompt in Enquirer?

I'm using Enquirer, not Inquirer, but there is no tag for Enquirer and I don't have 1500 reputation to create one, so I'm using Inquirerjs instead. Code of example prompt, where I tried to use object ...
ealexandrohin's user avatar
0 votes
0 answers
84 views

Resetting process.std.in after using inquirer.prompt()

In the code below, I'm capturing keypress events and it works fine. When the "s" key is typed, it starts a prompt asking for the user name and prints it. The issue is after using inquirer ...
Stephane's user avatar
  • 5,038
0 votes
1 answer
248 views

With vite you can specify which language/framework you want to use when createing the project. Is it possible to do this for my custom react teplate

Lets say i have an react typescript template. Now there are 2 slightly different versions of the template. It would be cool if there is an approach to configure the template with the console. An ...
CenterADiv's user avatar
0 votes
0 answers
234 views

How can I implement keypress on a cli with inquirer?

I created a CLI in typescript using Inquirer but I can't implement a logic to support the command ctrl+v! I found, on inquirer/core, the method useKeyPress but I don't understand how I can use it in a ...
Filippo1980's user avatar
  • 2,745
0 votes
1 answer
549 views

How can I exit Inquirer prompt based on answer?

I’m working on an application that sets a series of questions to generate an employee profile. As it is intended to be recursive, the user will be asked at the beginning and the end of the prompt to ...
Sagos's user avatar
  • 1
1 vote
1 answer
496 views

Repetitive prompting with validation in Inquirer.js when using a validation function featuring fetch

In the context of Inquirer.js, one of my question-prompts involves a validation function to check if the user-supplied Github username exists. This validation function uses an fetch function in order ...
shau's user avatar
  • 13
0 votes
1 answer
549 views

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: '...
mardo's user avatar
  • 683
0 votes
1 answer
570 views

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: ...
johnwargo's user avatar
  • 707
0 votes
1 answer
77 views

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 ...
no iam's user avatar
  • 1
2 votes
2 answers
15k views

ReferenceError: require is not defined in ES module

I'm trying to use the command node index.js within the terminal to bring up the prompts I made and keep running into several errors, I looked them up on here seemingly fixed it and got another error. ...
user avatar
1 vote
1 answer
1k views

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() ...
JShoe's user avatar
  • 3,318
-1 votes
1 answer
451 views

.then is not a function?? inquirer node js

I have a basic function im trying to run with node js and inquirer, and when i run it console log gives me this error. TypeError: inquirer.createPromptModule(...).then is not a function. I have seen a ...
Zac0088's user avatar
-1 votes
1 answer
326 views

How do I format data from an Inquirer output into markdown file

I'm making a README generator for a school project, and my inquirer prompts are all functioning fine, but when I call the data from this prompt: { type: "checkbox", name: "languages&...
BarkMulcher's user avatar
0 votes
0 answers
295 views

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 ...
SJaka's user avatar
  • 790
1 vote
0 answers
97 views

Getting UNDEFINED when trying to render my index.html

I cannot get my function generatePage to display all the data collected from my prompts. I keep getting undefined as return when the page is rendered. I already made some changes and change some ...
babaphillips's user avatar
1 vote
1 answer
2k views

Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`,

I don't know why am I getting the following error which say: Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working ...
crispengari's user avatar
  • 8,711
0 votes
1 answer
795 views

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 ...
aaburz's user avatar
  • 1
0 votes
1 answer
972 views

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. ...
user avatar
0 votes
0 answers
594 views

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() { ...
TheBooker66 aka Ethan's user avatar
0 votes
1 answer
480 views

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 ...
jcobo1's user avatar
  • 1,095
3 votes
3 answers
539 views

how to call another page function name in inquirer node js

I am making a CLI using inquirer in nodejs. So in Every choice list I have to give Exit choice so if user want to exit he/she can easily Exit. So I have to write Exit again and again to avoid that ...
user avatar
-1 votes
1 answer
123 views

How can I make a update prepared statement work in JavaScript in Node JS

.then(function (val) { var roleId = roleArr.indexOf(val.role) + 1; db.query( 'UPDATE employee SET role_id = ? WHERE first_name = ? AND last_name = ?;', [roleId, val....
smasherCoder's user avatar
1 vote
0 answers
385 views

Pipe output of an interactive script in shell

I have a large Node repo with many npm scripts to manage the project. I created an interactive script with Inquirer.js to act as an entry point to help developers to navigate. The script outputs the ...
miklosme's user avatar
  • 791
0 votes
1 answer
1k views

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 ...
Reece's user avatar
  • 1
0 votes
1 answer
282 views

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. ...
Hanzo Hattori's user avatar
0 votes
1 answer
901 views

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 ...
Kevin Chewning's user avatar
1 vote
0 answers
601 views

Typescript: Get correct answers type from inquirer questions array

I have an inquirer questions array like the following: const prompts = [ { type: 'input', name: 'foo', message: 'Enter a string', }, { type: 'number', ...
DeX3's user avatar
  • 5,339
0 votes
1 answer
3k views

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? ...
Manuel Abascal's user avatar
1 vote
1 answer
272 views

Fetching data axios

I am fetching data from an api and its response is something like this { "id": "BTC", "currency": "BTC", "symbol": "BTC", &...
rickster's user avatar
  • 304
0 votes
0 answers
307 views

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 ...
Zawedcvg's user avatar
0 votes
1 answer
976 views

'Function to return a choices array' in NPM inquirer (JavaScript)

I am trying to figure out how to use a function to return choices in an inquirer prompt but I can't seem to find any examples or explanations on how to do this. I have a MySQL2 query: db.query(`SELECT ...
sarawrmas's user avatar
0 votes
1 answer
202 views

nodejs - how to remove part of a string after a delimiter

I'm using this code in a nodejs script to push some elements inside an array for list question type of inquirerjs. for (let [index, torrent] of results.entries()) { if (torrent.seeds > 0 &&...
newbiedev's user avatar
  • 3,061
0 votes
1 answer
792 views

nodejs - set variable inside switch statement then pass it to axios

I'm using inquirer.js to create a simple prompt for a CLI script. I'm trying to set a variable value inside a switch statement then use this variariable inside an axios instance configuration. I'm ...
newbiedev's user avatar
  • 3,061
1 vote
1 answer
1k views

Inquirer.js populate list choices from sql database

I"m using inquirer.js to build a commandline employee database. Is it possible to populate the choices array dynamically from a sql database in inquirer.js? for example inquirer.prompt([ {...
Julius's user avatar
  • 63
3 votes
1 answer
1k views

Send a string and Enter key to a Node.js script from command line

I am running a Node.js script in Linux that prompts (via lib) user for a code. I get the process id of the script: pgrep -f test.js and then pass it the code with a new line to simulate Enter key: ...
Haris ur Rehman's user avatar
0 votes
2 answers
243 views

How can I run a command once fs is done writing to a file?

Here is the code in question: const scriptFiles = fs.readdirSync(scriptsPath) .filter(file => file.endsWith(".sql")); for (const file of scriptFiles) { ...
Revircs's user avatar
  • 1,322
3 votes
0 answers
727 views

How To Debug Node CLI (Interactive Prompts with Inquirer) With VS Code?

I have a Node CLI built with Commander and Inquirer. I'm currently trying to debug the application using VS Code. My current launch.json configuration: { // Use IntelliSense to learn about ...
StephenWeiss's user avatar
0 votes
1 answer
2k views

Passing SQL queries into Inquirer Prompt

I'm trying to pull in SQL query results and populate choices in inquirer prompt. When console logging 'choices,' it displays an array of objects from the SQL query that is called, but when calling ...
David's user avatar
  • 1
0 votes
1 answer
3k views

Inquirer.prompt exiting without an answer

I was wondering if anybody could help me out with an explanation as to why the below code would cause the command line to exit without waiting for an answer from the user. init(); function init() { ...
CJL1992's user avatar
  • 41
5 votes
2 answers
3k views

How to clear wrong input in Inquirer.js

const inquirer = require("inquirer") var questions = [ { type: "number", name: "name", message: "Please the number of players", validate: ...
Shah's user avatar
  • 75
0 votes
2 answers
2k views

what does `program.parse(process.argv)` do in commander.js?

I want to user commander.js and inquirer.js to ask questions and collect the answer to create a User instance: // index.js const mongoose = require('mongoose'); const User = require('./model/user') ...
Yingqi's user avatar
  • 1,205
0 votes
2 answers
3k views

How do I invoke inquirer.js menu in a loop using Promises?

I wrote a simple Node.js program with a nice menu system facilitated by inquirer.js. However, after selecting an option in the menu and completing some action, the program exits. I need the menu to ...
Web User's user avatar
  • 7,588
0 votes
1 answer
4k views

Node js - problem inplementing Inquirer.js for CLI app?

I'm having problems getting inquirer.js to work smoothly in a simple CLI that I'm working on. First, the prompt question repeats several times and this needs to be fixed. Second, I wrote the code as ...
Robogenus's user avatar
0 votes
0 answers
557 views

How to make inqurerjs work with async/await [duplicate]

I've got a function which uses inquirer to ask a series of questions and then calls a function in the inquirer.prompt(q).then() function with the answers. This works perfectly well but I'm trying to ...
Alex Foxleigh's user avatar