Electron's stdout disappears in VSCode DEBUG CONSOLE under Windows
Hi,
VSCode is so great and I have used it to develop electron applications for several months. Thank you guys for developing such great tool! :-)
My development environments are OSX and Windows. I just found an inconsistent behaviour between them. Would you like to take a look, please? Thanks.
My launch.json file is as follows, which is used to launch electron app using electron executable instead of node executable.
{
"name": "sample app",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/test/app`.js",
"stopOnEntry": false,
"args": [
],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/electron.exe", // <----it points to Electron.app/Contents/MacOS/Electron under OSX
"runtimeArgs": [
],
"env": {
},
"sourceMaps": true,
"outDir": null
},
There are some debug prints in app.js:
// app.js
console.log('this is for debugging');
Then I press F5 to launch it. It works well under OSX: 'this is for debugging' message is dumped into DEBUG CONSOLE in vscode. However, there is nothing in DEBUG CONSOLE under Windows platform - except the first message indicating the debugging started:
c:\VisualStudioCode\electron.exe --debug-brk=7145 -test\app.js
VS code is at latest 0.10.8 version(this issue also found in 0.10.7). Both Windows 7 64bit and 10 64bit have this problem.
Did I miss something? Any suggestions/tips/workarounds, please let me know. I've been in this trouble for serveral days. Thanks very much.
By the way, if I remove the line "runtimeExecutable": "${workspaceRoot}/electron.exe" and using node.exe instead, everything works fine.
Having the same issue (as per the title). Only stderr is showing on the Debug Console. Seems to have been introduced with 1.9.0.
Here is the launch config I use:
{
"type": "node2",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}\\server\\main.js",
"cwd": "${workspaceRoot}",
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart"
}
@nsgundy does it help if you switch the debug type from 'node2' to 'node'?
@nsgundy does it help if you switch the debug type from 'node2' to 'node'?
Yes, seems fine with "type": "node".
@nsgundy you are seeing a different problem as @TheLevenCreations because you are not using Electron but the new experimental node debugger 'node2'. Please file a separate issue for this.
I am having the same problem but with "node":
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/bin/task_runner.js",
"cwd": "${workspaceRoot}",
"env": {
"NODE_ENV": "development"
}
}
Only stderr is shown:
node --inspect=25779 --debug-brk bin/task_runner.js -u tarot.com
Debugger listening on port 25779.
Warning: This is an experimental feature and could change at any time.
Debugger attached.
I am using 1.10.0-insiders.
With 1.9.0 it works perfectly.
Update: Didn't see https://github.com/Microsoft/vscode/issues/19750
@hrgui, the output of your debugging session does indicate that you are running with the node2 debug adaptor (--inspect was passed). Is it possible that you launched with node2 and then while the session was still running, changed to node and clicked restart? To change the debug adapter you do seem to have to stop the debugging session.
@weinand Will open a new issue, thank you.
Please note: 'node2' is gone in Insider!
Background: for the February milestone we are planning to provide a unified Node Debugging Experience by merging 'node' and 'node2' into one debugger and making the switching automatic.
@hrgui since you are using the Insider release, you can see a preview of the unified Node Debugging Experience already today (and the console output 'experimental' is an indication that VS Code has picked 'node2' for you).
If you do not want to let VS Code choose the debug adapter, you can override this by setting the protocol attribute to legacy (for 'node) or v8-inspector (for 'node2').
The original issue has been fixed in Electron:

I've been encountering this issue lately in VS Code 1.13.1 with Electron 1.7.2. I put a console.log statement in my main process script, and the Debug Console outputs nothing.
@weinand @craxal me and my team are getting this behavior since we changed from legacy to inspector.
It seems to be working in OSX but not in Windows. No outputs to the Debug Console.
We're using vscode 1.16.1 x64, node 7.9.0 & electron 1.7.6.
I've tested the ia32 version and it presents the same behavior. Insiders, both x64 and ia32, too.
@robertohuertasm since this issue has been closed and you have switched the protocol to "inspector", your issue is unrelated and you should create a new issue for it with detailed and reproducible steps.