Node.js調試

         Node.js是一個能夠快速構建網絡服務及應用的平臺。該平臺的構建是基於Chrome's JavaScript runtime,也就是說,實際上它是對Google V8引擎(應用於Google Chrome瀏覽器)進行了封裝。 今天介紹Node.js調式目前有幾種方法,Built-in的調試功能咱們在這兒不介紹了,在這兒主要介紹第三方的,第一種方法使用:node-inspectorhtml

經過npm來安裝:前端

$ npm install -g node-inspectornode

用如下方法來啓動調試:git

$ node-debug app.jsgithub

而後自動打開默認瀏覽器,http://127.0.0.1:8080/debug?port=5858, 這裏推薦Google Chrome Developer Tools,以下圖所示:web

nodeinspector11

能夠看到Call Stack,Scope  Variables. 支持單步調試。chrome

第二種方法,使用商業產品 WebStorm IDE,是jetbrains公司旗下一款JavaScript 開發工具。被廣大中國JS開發者譽爲「Web前端開發神器」、「最強大的HTML5編輯器」、「最智能的JavaScript IDE」等。
安裝之後,打開相應的項目,Debug以下圖:數據庫

NodeJSDebugging

從UI界面上,提供了詳盡的信息,breakpoint, console,scripts,variables.npm

 

還有一些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

相關文章
相關標籤/搜索