我正在使用 NodeJS 制作一个应用程序,它是一个 CLI 应用程序;为了获取用户的输入,我使用“提示”模块。我可以使用它,但是在输入提示符时,每个字符都会重复,但是输出很好!代码如下。请帮忙。
prompt.start();
prompt.get({
properties: {
name: {
description: "What is your name?".magenta
}
}
}, function (err, result) {
console.log("You said your name is: ".cyan + result.name.cyan);
});
图片:
最佳答案
在使用“提示”模块之前,我使用的是ReadLine接口(interface);遗憾的是我也遇到了同样的问题。然而,修复很简单:
Remove the
rli.close();
and then run it.Then re-add the
rli.close();
and it works!
感谢 mscdex 的输入:)
关于node.js - NodeJS 中的提示模块重复输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26741503/