2017-01-19 35 views
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控制檯運行。你有什麼想法如何解決它?

回答

2

我找到了答案。

  1. 型WebStorm終端: $節點--debug-BRK 網絡風暴會給你調試器監聽的端口號。在我的機器上是5858.然後按'Ctrl + C'。

  2. 創建一個新的調試配置爲以下之一:再次 enter image description here

  3. 在WebStorm終端類型: 「$節點--debug-BRK main.js」

  4. 將斷點地方。
  5. 點擊調試圖標 enter image description here

快樂調試!

相關問題