Node.js debugger based on Blink Developer Tools
Перейти к файлу
Danny Coates 25670cbd19 refactored debug-server 2011-07-16 00:28:13 -07:00
bin refactored debug-server 2011-07-16 00:28:13 -07:00
front-end Improve support for user stylesheets 2011-04-23 12:51:38 -06:00
lib refactored debug-server 2011-07-16 00:28:13 -07:00
test list breakpoints on connect 2010-10-25 00:39:15 -06:00
.gitignore updated dependencies 2011-07-13 22:04:52 -07:00
ChangeLog version 0.1.6 - closes #25 2010-12-14 18:29:12 -07:00
config.json version 0.1.2 2010-11-26 23:59:14 -07:00
package.json updated dependencies 2011-07-13 22:04:52 -07:00
readme.md added some profiles panel info to readme 2010-12-01 23:15:52 -07:00

readme.md

Node Inspector is a debugger interface for nodeJS using the WebKit Web Inspector.

Getting Started

Requirements

  • nodeJS
    • versions: 0.3.0 or later
  • A WebKit based browser: Chrome, Safari, etc.
  • Optional v8-profiler to use the profiles panel

Install

  • With npm npm install node-inspector
  • Or from source

Debugging

As an example lets debug test/hello.js, from the root project directory (node-inspector)

  1. start the inspector in the background node-inspector &

  2. start the node instance to debug node --debug test/hello.js

  3. open http://127.0.0.1:8080/debug?port=5858 in your favorite WebKit based browser

    Chrome 5 users MUST use 127.0.0.1 NOT localhost or the browser will not connect to the debugger

  4. you should now see the javascript source from nodeJS

  5. select the hello.js script and set some breakpoints (far left line numbers)

  6. now open http://127.0.0.1:8124/ in a new tab then go back to inspector tab

  7. click "Step over next function call" and observe changes in the RHS panel

  8. then watch the screencast

For more information on getting started see the wiki

Options

	--web-port=[port]     port to host the inspector (default 8080)

Cool stuff

  • the WebKit Web Inspector debugger is a great js debugger interface, it works just as well for node
  • uses WebSockets, so no polling for breaks
  • remote debugging
  • javascript top to bottom :)
  • edit running code

Known Issues

This is beta quality code, so use at your own risk:

  • be careful about viewing the contents of Buffer objects, each byte is displayed as an individual array element, for anything but tiny Buffers this will take too long to render
  • while not stopped at a breakpoint the console doesn't always behave as you might expect
  • closing the browser does not stop debugging, you must stop node-inspector manually

Profiling

To use the profiles panel, install the v8-profiler module:

	npm install v8-profiler

To use it do something like:

	var profiler = require('v8-profiler');
	
	profiler.startProfiling('startup');
	slowStartupFoo();
	profiler.stopProfiling('startup');
	
	profiler.takeSnapshot('beforeLeak');
	leakyFoo();
	profiler.takeSnapshot('afterLeak');

Then view the profiling results with the profiles panel in node-inspector. You can also take heap snapshots on demand from the profiles panel.

Thanks

This project respectfully uses code from and thanks the authors of: