2
我用'readline-sync'依賴寫下面的代碼。如何在WebStorm中使用readline-sync npm存儲庫?
var readlineSync = require('readline-sync');
function main() {
printMenu();
var userName = readlineSync.question('Please enter your choice:');
console.log(userName);
}
main();
我從WebStorm嘗試使用WebStorm控制檯窗口運行此代碼。 我得到了錯誤:
Error: The current environment doesn't support interactive reading from TTY. stty: when specifying an output style, modes may not be set
當我從Linux終端運行的代碼工作,沒有錯誤。我從錯誤消息中瞭解到'readline-sync'無法從WebStorm控制檯運行。你有什麼想法如何解決它?