-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot see console output on Windows #685
Comments
The console's output doesn't show at the cmd. You can see the output at the devtools |
Please read the last sentance. Devtools is not enough since I need the ENTIRE stdout, including logs of C++ node.js modules, npapi plugins and node-webkit itself. Devtools will only show webkit output and anything from the JS console functions. |
You can try run node-webkit with Reference: http://www.chromium.org/for-testers/enable-logging |
I found this similar problem: https://groups.google.com/forum/?fromgroups#!topic/native-client-discuss/jm9Vw4crezs |
👍 it should log to somewhere, shouldn't it? |
When I use |
@Ivshti did you ever find a fix for this? I'm trying to debug a node.js native module built for nw. It works on Linux but not Windows, and I'm unable to see any any of my STDOUT/printf messages since nw seems to be swallowing them. Any tips on how to get debug output to the CMD window (or in my case, MSYS) would be appreciated. |
@orthecreedence yes, --enable-logging shows the console log under newer versions. Apparently something was broken before. Anyway. I don't know if this will show you logs from a node module. |
Bump, not working for me with the latest release in Windows |
@Ivshti Do you do --enable-logging on the output binary for windows or does it need to be done during build somehow? |
@mydigitalself I believe you add it within the package.json |
@mydigitalself the binary. It's part of "Content API of Chromium" mentioned at https://github.com/rogerwang/node-webkit/wiki/Command-line-switches. Weirdly though, on Windows 8.1 now it doesn't seem to log anything for me still. I'm also using another switch ( |
I couldn't get it to work at all using that mechanism on Windows 7, when running the binary it spawns out a new window and returns to the command prompt. However, I did find the secret hidden code for enabling Sawbuck, and that works a treat. |
Is there any way to see stdout/stderr on Windows? |
Has someone figure out how to debug on windows? It is pretty tough if you cannot see any console output :S |
It's supported via passing |
The When I load up this content, either by referring to the html in my package.json or by loading it via nw.Window.open(...), I see none of the my test html (named main.html): <html>
<head>
<script type='text/javscript'>
console.log("at INIT: console output");
process.stdout.write("at INIT: stdout output!");
process.stderr.write("at INIT: stderr output!");
window.addEventListener('load', function(evt) {
console.log("on LOADED: console output");
process.stdout.write("on LOADED: stdout output!");
process.stderr.write("on LOADED: stderr output!");
});
</script>
</head>
<body>
Some Content!
</body>
</html> when i test loading this from a .js file, I just run and for good measure, here is my package.json: {
"name": "nwStdStreamsTest",
"description": "a dumb project to verify nw.js bugs.",
"version": "0.0.1",
"main": "main.html",
"window": {
"show": true,
"frame": true,
"toolbar": true,
"show_in_taskbar": true,
"min_width": 100,
"min_height": 100,
"resizable": true
},
"dependencies": {
"nw": "= 0.23.6-sdk"
}
} I am primarily a Linux user and have seen this feature working on OS X as well as Linux, as one would expect STDOUT and STDERR to work. I've also seen all of the other bugs reporting this same issue but IMHO there doesn't seem to be a lot of attention to this issue from the nw team. The consensus appears to be, unilaterally, that it DOES work and everyone else is just plain wrong. If anything, I'd call this a bug based solely on the fact that it compromises expectations from standard streams, which haven't changed as far as back as anyone can remember and might be just about as "legacy" as legacy can get. This complexity will, in turn, be inherited by consuming implementations, adding a catch-22 to otherwise cross-platform applications. |
This used to work great for me, if I put |
I'm also trying to see console output on Windows 7. Adding |
Same problem here. I've developed a native addon, and trying to debug issues with it is very difficult without being able to see a console log. |
Workaround: visible NW.js console output on WindowsPut this script in the same directory that you would run You'll probably need to have The resulting logging behavior is the same as I get on OSX. (Where I didn't have to bother with a wrapper just to make sure stdout and stderr actually get displayed somewhere.) Before: https://i.imgur.com/CmRgNMT.png // Run nwjs
const childProcess = require("child_process");
const proc = childProcess.exec("nw .");
// Keeps this wrapper process running
let keepAlive;
let quit = false;
function keepAliveCallback(){
if(!quit) keepAlive = setTimeout(keepAliveCallback, 1000);
}
keepAliveCallback();
// Relay stdout and stderr from process until it exits
proc.stdout.on("data", function(data){
process.stdout.write(data);
});
proc.stderr.on("data", function(data){
process.stderr.write(data);
});
proc.on("exit", function(){
quit = true;
}); |
@pineapplemachine that worked for me, THANKS! I just had to add some adjustments to my console.log logger, it works if I use a single string/argument, not more than one, but it's fixable with JSON.stringify :) |
Thanks @pineapplemachine. This also saved me, today. I'm surprised this is still necessary, when this has been an issue for so long. @rogerwang Can't a better nw CLI parameter be added to automatically dump console to stdout instead of spawning a new process and returning to the shell? |
+1 |
It this what you are looking for? |
FWIW, I've just published A binary executable ( |
Hello,
It seems that node-webkit does not have console output on Windows (it just forks as a background process), which prevents me from properly debugging a custom NPAPI browser plugin.
How can this be solved?
The output in the debugger does not do the job, since it only outputs JS logs.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: