简体   繁体   English

NodeJS 输出未显示在 Visual Studio 2017 中

[英]NodeJS Output Not Showing In Visual Studio 2017

I'm trying to get started with NodeJS (8.12.0) in Visual Studio 2017 (15.8.4).我正在尝试在 Visual Studio 2017 (15.8.4) 中开始使用 NodeJS (8.12.0)。 My understanding is that Node's output is supposed to appear in the Visual Studio 2017 Output window ( https://stackoverflow.com/a/49589521 ), but it is not.我的理解是 Node 的输出应该出现在 Visual Studio 2017 输出窗口 ( https://stackoverflow.com/a/49589521 ) 中,但事实并非如此。 I also thought that in the case of an error/exception, Node's pop-up console should remain open until you dismiss it ( http://www.intstrings.com/ramivemula/articles/jumpstart-35-prevent-visual-studio-node-js-console-closing-immediately-after-execution/ ), but that also seems not to be the case: if I run code with an exception, the console pops up & immediately closes.我还认为,在出现错误/异常的情况下,Node 的弹出式控制台应该保持打开状态,直到您将其关闭( http://www.intstrings.com/ramivemula/articles/jumpstart-35-prevent-visual-studio- node-js-console-closure-immediately-after-execution/ ),但情况似乎并非如此:如果我运行代码时出现异常,控制台会弹出并立即关闭。

With no errors in the code I can force the console to stay open with something like:如果代码中没有错误,我可以强制控制台保持打开状态,例如:

setTimeout(function () { process.exit(); }, 5000);

...But obviously that's just a workaround, and it still doesn't work if there's actually an error. ...但显然这只是一种解决方法,如果确实存在错误,它仍然不起作用。

Am I wrong in that Node should be outputting to VS's output window, and/or remaining open to allow me to read potential errors?我错了,Node 应该输出到 VS 的输出窗口,和/或保持打开状态以允许我读取潜在错误? I've googled & googled, but can't seem to figure out why neither of these are happening in my case, nor how to resolve them.我已经用谷歌搜索过,但似乎无法弄清楚为什么在我的情况下这些都没有发生,也不知道如何解决它们。 Any thoughts would be greatly appreciated.任何想法将不胜感激。

Check Visual Studio 2017 Node.js Exceptions not working检查Visual Studio 2017 Node.js 异常不起作用

Escpecially "Debug->Windows->Exceptions->Enabling JavaScript (Node.js 8+)" did the trick.特别是“调试->Windows->异常->启用JavaScript(Node.js 8+)”做到了这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM