Option selection bug in CLIs on Windows

When you can't use your arrow keys to select options in CMD or Powershell.

Published: June 26, 2019

I just encountered this perplexing bug, so here are some quick notes.

What happens

Using any Node-based CLI application (such as Vue CLI), you can’t select options because the arrow keys don’t work. As soon you you navigate to another option, it jumps back to the first option on the list.

The following shows it in action when using the Netlify CLI tool, Node 11.9.0 and Powershell: Error in action

Why

This seems to occur periodically, with a range of Node versions. A quick Google brings up bug reports scattered across the years, including this one (selected because it’s one of the clearer discussions). The problem is associated with TTY. The latest version where I’ve encountered it is 11.9.0

How to fix

Update Node.js. I updated to 12.4.0, and all is well again.