简体   繁体   中英

I'm using JS in VScode and I'm trying to take user input through prompt cmd, but it's not working. I've already installed prompt-sync

I'm trying to write a simple code to take input from the user using the prompt cmd with the Node.js debugger in VScode, but nothing appears on the console, as if the code is forever running.

What should I do?

I've already installed prompt-sync via Command Prompt using: npm install prompt-sync .

Also, I used const prompt = require('prompt-sync')(); as recommended by the README.md within the prompt-sync documentation.

However, when I write

const name = prompt('Whats your name? ');
console.log(`${name}`)

nothing happens on the DEBUG CONSOLE and the code never stops running.

I had the same problem and solved adding

"console": "integratedTerminal"

to the launch.json in VSCode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM