NodeJS – 一个NodeJS的分步debugging器
我正在寻找有效的方法来逐步debuggingNodeJS服务器代码。 在这一刻,我使用了几十个console.log(),这非常困难。 完美的工具是让我检查堆栈中的每个variables的值,并逐行跟踪我的程序。 首选OS = MacOS / Linux。 可能吗?
这个怎么样?
您可以尝试testingNodeclipse版本0.2.0testing版。
http://www.tomotaro1065.com/nodeclipse/
它将帮助您轻松地debugging节点应用程序。
expression项目的生成
Select the [File]-[New]-[Project] menu. Select [Node]-[Express Project], and push [Next] button. Enter [Project name], and push [Finish] button.
debugging
Open the JavaScript source files that you want to set breakpoints. Double-click on the ruler at the left end of the line you want to set a breakpoint. If you want to remove a breakpoint, double-click on the ruler again. Select the main source file of Node Application on the Project Explorer, open the context menu by right-clicking, select the [Debug As]-[Node Application] menu.
基本上,Node.js是build立在V8之上的,所以它的debuggingfunction也是build立在V8的debuggingfunction基础之上的。
V8有一个包含的debugging程序,可以通过端口5858上的TCP进行访问。
所以基本上所有你需要的是一个能够连接到5858端口的前端,并讨论V8的debugging协议。
一个select是使用基本上在浏览器中提供debuggingUI的节点检查器。 不幸的是,它只适用于谷歌浏览器和苹果Safari(对我来说没有问题,但可能有其他人;-))。
另一个select是使用Eclipse的插件 。
最后但并非最不重要的一点是,Node.js的内置debugging器(总是让我想起MS-DOS的edlin
)也仅仅是这个TCPdebugging器的一个前端,它只是一个内置的debugging器。
当然,还有更多的select……这三个只是我脑海中的前三个;-)
使用node-inspector
来提供您正在查找的节点debugging环境。 这是梦幻般的。
检查WebStorm 。 这是一个非常棒的IDE,你也可以直接运行你的nodejs代码,或者连接到一个已经启动debugging的节点进程。 在这两种情况下,WebStorm都提供了您所要查找的内容:逐行跟踪程序并逐行检查每个variables的状态。
尝试使用nodeunit npm模块来testingnodejs服务器端代码。
即使问题是很古老的,有一个来自微软的“Visual Studio代码”的一个很棒的IDE,它是用Javascript(Typescript)意图开发的,它能够debuggingNode JS项目
检出这个链接https://code.visualstudio.com/docs/nodejs/nodejs-debugging