I am playing with the core modules of node js in VS code and i m unable to get it working with "readline" module.
I have the following code in js file.
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Is it working ?', function (answer) {
console.log(answer);
});
when i run it this is what i see in debug console
node --debug-brk=4868 --nolazy Core.js
Debugger listening on port 4868
Is it working ?
No
not available
I am not sure what;s the issue here but it fails to log the answer to the console.
The Visual Studio Code documentation states that the 'Debug Console does not support programs that need to read input from the console'. To debug these programs you need to 'enable an external, native console by setting the attribute externalConsole to true in your launch configuration.' This documentation can be found here: Visual Studio Code Debugging See the section on Node Debugging.
When you add this setting to your launch configuration, VS Code will launch an external console that you can interact with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With