Uncaught ReferenceError when using rl.question node.js

Viewed 26

I've been trying to search a solution for a while for and I have found nothing.

I'm trying to create a node.js terminal menu using rl.question, however when I insert a number/letter I get the following error:

When inserting a letter: Uncaught ReferenceError ReferenceError: t is not defined

Here is the code:

function menu() {
  console.log("Please select an option from the menu below.")
  console.log("1. Group Shout")
  console.log("2. Group Wall Post")
  console.log("3. Database")
  console.log("4. Discord Bot")
  console.log("5. Settings")
  console.log("6. Exit/Restart")
  rl.question("Please select an option: ", function(answer) {
      if (answer == "1") {
        rl.close();
          console.log("Group Shout")
          rl.question("Please enter the group shout: ", function(answer)
          {
              roblox.shout(group, answer)
              console.log("Shout sent: " + answer)
              menu()
          })
1 Answers

Sorry I am not “graded” enough to comment on your question but I would like to suggest Inquirer.js in case you don’t know it.

https://www.npmjs.com/package/inquirer

It is incredibly powerful with all sorts of user input types. There is also a rxjs interface to build dynamic questions.

Related