Node.js是一个可以快速构建网络服务及应用的平台。该平台的构建是基于Chrome's JavaScript runtime,也就是说,实际上它是对Google V8引擎(应用于Google Chrome浏览器)进行了封装。 今天介绍Node.js调式目前有几种方法,Built-in的调试功能我们在这儿不介绍了,在这儿主要介绍第三方的,第一种方法使用:node-inspector

通过npm来安装:

$ npm install -g node-inspector

用以下方法来启动调试:

$ node-debug app.js

然后自动打开默认浏览器,http://127.0.0.1:8080/debug?port=5858, 这里推荐Google Chrome Developer Tools,如下图所示:

nodeinspector11

可以看到Call Stack,Scope  Variables. 支持单步调试。

第二种方法,使用商业产品 WebStorm IDE,是jetbrains公司旗下一款JavaScript 开发工具。被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。
安装以后,打开相应的项目,Debug如下图:

NodeJSDebugging

从UI界面上,提供了详尽的信息,breakpoint, console,scripts,variables.

 

还有一些Node.js相关的工具:

Profiling with node Profiler
CPU and Memory Profiling with NodeTimelook
Webkit Developer Tools Profiling with Node Webkit Agent
Interactive Cloud9 Debugging Guide here
Heapdumps to Webkit Developer Tools Tool and guide here
Logging Libraries that output Debugging Information Caterpillar Tracer
Flamegraphs with Dtrace and StackVis  Only supported on SmartOS

 

希望对您软件开发有帮助。

您可能感兴趣的文章:

Durandal介绍
Database数据库切片模式


作者:Petter Liu
出处:http://www.cnblogs.com/wintersun/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
该文章也同时发布在我的独立博客中-Petter Liu Blog

posted on 2014-06-02 11:48  PetterLiu  阅读(3583)  评论(0编辑  收藏  举报