Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terminal not accepting user input #555

Closed
NoelAnnParisi opened this issue Jun 20, 2017 · 6 comments
Closed

terminal not accepting user input #555

NoelAnnParisi opened this issue Jun 20, 2017 · 6 comments

Comments

@NoelAnnParisi
Copy link

NoelAnnParisi commented Jun 20, 2017

my code is as follows:

inquirer.prompt([{
    type: 'list',
    name: 'userCommand',
    message: "What do you want Liri to do?",
    choices: ['my_tweets', 'spotify-this-song', 'movie-this', 'do-what-it-says']
}]).then(answer => {
    //depending on what they choose liri will do something!
    switch (answer.userCommand) {
      //retrieve 20 most recent tweets
      case "my_tweets":
        var params = { screen_name: 'noelannparisi' };
        twitterAccess.get('statuses/user_timeline', 'count:20', function(error, tweets, response) {
          if (!error) {
            for (tweet in tweets) {
              console.log("You tweeted:", tweets[tweet].text, " on", tweets[tweet].created_at + "\n\n");
              fs.appendFile('log.txt', tweets[tweet].text + tweets[tweet].created_at, 'utf8', err => {
                if (err) {
                  console.log('All done!');
                }
              });
            }
          }
        });
        break;
      //search for a song!
      case "spotify-this-song":
      console.log(answer.userCommand); inquirer.prompt([{
          type: 'input',
          //if they don't type in anything this song's info will display
          default: 'The Sign, Ace of Base',
          name: 'song',
          message: "What song do you want to look up?"
        }]).then(answer => {//do stuff}

The terminal never allows the user to begin typing when 'spotify-this-song' is chosen. I am using the latest version and requiring in the library. Any idea as to why? Thank you so much!

@SBoudrias
Copy link
Owner

What's your Node.js version?

Also, is this example working for you? https://github.com/SBoudrias/Inquirer.js/blob/master/examples/hierarchical.js

@ctrlplusb
Copy link

Also experiencing this.

I tried your example. The first question responded, second question hangs.

Node 8.1.0

Will try update to 8.1.2 and report back

@ctrlplusb
Copy link

8.1.2 resolves the issue 👍

@NoelAnnParisi
Copy link
Author

NoelAnnParisi commented Jun 22, 2017 via email

@SBoudrias
Copy link
Owner

Yeah, Node 8.1.0 broken the Readline module. The latest release fixes it.

@NoelAnnParisi try it out and close the issue if it's now working for you.

Thanks everyone :)

@NoelAnnParisi
Copy link
Author

Upgrading my node version solved it! Thanks so much :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants