如何在WebStorm中使用readline-sync npm存储库?
我使用'readline-sync'依赖关系编写了下面的代码。
var readlineSync = require('readline-sync'); function main() { printMenu(); var userName = readlineSync.question('Please enter your choice:'); console.log(userName); } main();
我从WebStorm运行这个代码,尝试使用WebStorm控制台窗口。 我得到了错误:
错误:当前环境不支持来自TTY的交互式阅读。 stty:指定输出样式时,可能不会设置模式
当我从linuxterminal运行它的代码工作没有错误。 我从错误信息中了解到'readline-sync'无法从WebStorm控制台运行。 你有什么想法如何解决它?
我find了答案。
-
inputWebStormterminal:$ node –debug-brk Web风暴会给你debugging器正在监听的端口号。 在我的机器上是5858.然后按“Ctrl + C”。
-
创build一个新的debuggingconfiguration如下:
-
在WebStormterminal中再次键入:“$ node –debug -brk main.js”
- 在某处放置一个断点。
- 点击debugging图标
快乐的debugging!