console.log() does not appear in my terminal (nwjs)

末鹿安然 提交于 2019-12-04 10:04:44

Please look at the list of changes related to node in the nw.js wiki.

Since node-webkit supports GUI applications instead of console applications, the output of console.log() (and other similar methods such as console.warn() and console.error()) is redirected to WebKit's console. You may see it in your “Developer Tools” window (on its “Console” tab).

You have to run DevTools for Background Page by right clicking on your app and choosing the Inspect background page option from the context menu.


click for full size image

Here is a related bug report: 0.13-beta3 console.log doesn't work in node context

ermenkoff

Just pass --enable-logging=stderr in chromium-args in your package.json:

{
    ...
    "chromium-args": "--enable-logging=stderr",
    ...
}

Or use the Inspect background page DevTools as @Jakub Bejnarowicz has pointed out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!