F.I.
F.I.

Reputation: 33

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"

inquirer
  .prompt([{
        "name":"King of France",
        "message":"Who is the king of France"
    }
  ])
  .then((answers) => {
    // console.log(answers)
    console.log("Nothing should be printed.")
  })
  .catch((error) => {
    if (error.isTtyError) {
        console.log(erorr)
    } else {
        console.log(error)
    }
  });

Which has the following outputs: console output showing twice the question asked through inquirer.js

To be more precise, it appears once when I launch the script and a second time just as I reply on my terminal.

Upvotes: 0

Views: 231

Answers (0)

Related Questions