Node's Commander can't prompt terminal

I'm using the popular Commander npm module in a command-line program i'm building. It works great except that all of the functions it provides that solicit user input -- aka, choose, prompt, and password -- fail to work.

As an example I'm using:

program
    .command('test')
    .action(function(param) {
        program.prompt('Username: ', function(name){
          console.log('hi %s', name);
        });

        program.prompt('Description:', function(desc){
          console.log('description was "%s"', desc.trim());
        });
    }
);

This results in the following error (yet it is copy and pasted directly out of the documentation/examples):

TypeError: Object # has no method 'prompt' at Command. (lib/tg.js:780:11) at Command.listener (node_modules/commander/index.js:249:8) at Command.emit (events.js:98:17) at Command.parseArgs (/node_modules/commander/index.js:480:12) at Command.parse (/node_modules/commander/index.js:372:21) at Object. (/lib/tg.js:806:9) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12)

Try using the Node Prompt module. Install it from npm with this command:

npm install prompt --save

The docs can be found here: https://github.com/flatiron/prompt

Make sure you also require it in your code, usually at the top.

var prompt = require('prompt');

Remember, Node is non-blocking. Multiple prompts will attempt to get user input at the same time. To get around this, split your prompts up into functions and call the next prompt in the callback.

Example:

var first_prompt = function() {
  var schema = {
    // Read the docs on creating a prompt schema
  };
  prompt.start();
  prompt.get(schema, function(err, result) {
    // Do stuff with the input

    // Call the next prompt
    next_prompt();
  });
};