You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brian Bothwell edited this page May 14, 2021
·
2 revisions
The following steps will allow viewing console logging from the full application, in both production and development environments. This will show console logs, JavaScript warnings/errors, and Chromium console messages from every window opened by NW.js as well as any scripts running in the Node context.
Install Node.js and ensure node is in your path.
Install the NW.js SDK and ensure nw is in your path.
Add the following to the package.json of the NW.js application:
"chromium-args": "--enable-logging=stderr",
Create the following debug.js script anywhere:
// Run nwjsconstchildProcess=require("child_process");constproc=childProcess.exec("nw .");// Keeps this wrapper process runningletkeepAlive;letquit=false;functionkeepAliveCallback(){if(!quit)keepAlive=setTimeout(keepAliveCallback,1000);}keepAliveCallback();// Relay stdout and stderr from process until it exitsproc.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;});
Run node /path/to/debug.js from within the directory where package.json is located.