我使用“readline-sync”依赖项编写了以下代码。
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 控制台上工作。您知道如何解决吗?
最佳答案
我找到了答案。
在 WebStorm 终端中输入: $ Node --debug-brk Web Storm 将为您提供调试器正在监听的端口号。在我的机器上是 5858。然后按“Ctrl+C”。
在 WebStorm 终端中再次输入:“$ node --debug-brk main.js”
- 在某处放置断点。
- 单击调试图标
调试愉快!
关于node.js - 如何将 readline-sync npm 存储库与 WebStorm 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41737166/