简体   繁体   English

在WebStorm中为node.js进行调试

[英]Debugging in WebStorm for node.js

I recently joined the team which uses the node.js for the development. 我最近加入了使用node.js进行开发的团队。 I am new to the whole node.js ride. 我是整个node.js的新手。 I have used IntelliJ based IDEs in the past to configure to run and debug different programming languages. 过去,我曾使用基于IntelliJ的IDE来配置以运行和调试不同的编程语言。 However lack of my understanding of node.js or for some other reason I cannot debug node.js application currently I am working on. 但是,由于缺乏对node.js的理解,或者由于某些其他原因,我无法调试当前正在使用的node.js应用程序。

Using node v0.10.48, npm 2.15.1 使用节点v0.10.48,npm 2.15.1

I can run the application using the WebStorm IDE, but when I run the application, following is what I get in the console tab of debug panel. 我可以使用WebStorm IDE运行该应用程序,但是当我运行该应用程序时,以下是在调试面板的控制台选项卡中看到的内容。 It also returns a > prompt in the console. 它还在控制台中返回>提示。

/usr/bin/node --debug-brk=44917 --expose_debug_as=v8debug <path_to_startup_js_file?
debugger listening on port 44917
debugger listening on port 44918

It stops for the break points that I put in the beginning of the file, but after starting the server nothing happens. 它会因我在文件开头放置的断点而停止,但是在启动服务器后没有任何反应。 Now I can't open client UI application, which makes calls to this node.js/express REST service. 现在,我无法打开客户端UI应用程序,该应用程序将调用此node.js / express REST服务。 Even though it is up and running, I think. 我认为即使启动并运行。

By the way I know how to debug using node-inspector & browser. 顺便说一句,我知道如何使用node-inspector和浏览器进行调试。 But not sure what am I doing wrong with IDE. 但是不知道我在用IDE做错什么。 The run profile works fine, but the same profile is not working for debug. 运行配置文件可以正常工作,但同一配置文件不适用于调试。

It turned out that application I was working on was spawning child process, which has to be debugged separately as a remote debugger. 原来,我正在处理的应用程序正在生成子进程,该子进程必须作为远程调试器单独进行调试。 Webstorm was nice enough to support debugging both master and child thread at the same time, via two separate debugger. Webstorm非常好,可以通过两个单独的调试器支持同时调试主线程和子线程。 The current node version used by the project is also relatively old. 项目使用的当前节点版本也相对较旧。 Which was also the part of the issue with the webstorm. 这也是网络风暴问题的一部分。 It was verified by the jetbrain support team member. 喷气脑支持小组成员对此进行了验证。

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

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