Node.js debugger based on Blink Developer Tools
Перейти к файлу
Miroslav Bajtos 839c3aebf2 README: added travis-ci and npm badges 2013-07-19 16:46:44 +02:00
bin Added version log message. 2013-07-15 13:42:47 +02:00
front-end Moved frontend overrides out of front-end folder 2013-06-04 07:47:39 +02:00
front-end-node Sourcemap support 2013-06-21 11:03:29 +02:00
lib Added version log message. 2013-07-15 13:42:47 +02:00
test squash! ScriptFileStorage: root detection change 2013-07-11 10:13:49 +02:00
tools Run ./tools/git-changelog to update ChangeLog 2013-06-05 12:40:27 -07:00
.gitignore Updated .gitignore 2013-07-19 16:43:05 +02:00
.npmignore Prepared for v0.3.0preview1 release. 2013-05-20 15:50:30 +02:00
.travis.yml Configured travis-ci build. 2013-07-19 16:44:17 +02:00
AUTHORS AUTHORS: updated Stronglooper's emails 2013-06-24 18:34:20 +02:00
ChangeLog released version v0.3.1 2013-07-15 15:53:01 +02:00
LICENSE Added BSD License 2011-10-22 19:03:07 -07:00
MAINTAINERS.md MAINTAINERS.md: fixed typo. 2013-07-12 08:46:04 +02:00
config.json default should be backwards compatible 2012-02-13 13:30:07 -05:00
package.json started work on v0.3.2 2013-07-15 15:56:02 +02:00
readme.md README: added travis-ci and npm badges 2013-07-19 16:46:44 +02:00

readme.md

Node Inspector

Build Status NPM version

Overview

Node Inspector is a debugger interface for node.js using the Blink Developer Tools (former WebKit Web Inspector).

Features

The Blink DevTools debugger is a great javascript debugger interface; it works just as well for node. Node Inspector supports almost all of the debugging features of DevTools.

  • Navigate in your source files
  • Set breakpoints (and specify trigger conditions)
  • Break on exceptions
  • Step over, step in, step out, resume (continue)
  • Continue to location
  • Disable/enable all breakpoints
  • Inspect scopes, variables, object properties
  • Hover your mouse over an expression in your source to display its value in a tooltip
  • Edit variables and object properties
  • (etc.)

Cool stuff

  • Node Inspector uses WebSockets, so no polling for breaks.
  • Remote debugging
  • Live edit of running code, optionally persisting changes back to the file-system.
  • Set breakpoints in files that are not loaded into V8 yet - useful for debugging module loading/initialization.
  • Javascript from top to bottom :)

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 most Buffers this will take too long to render.
  • While not stopped at a breakpoint the console doesn't always behave as you might expect.
  • Profiler is not implemented yet. Have a look at node-webkit-agent in the meantime.
  • Break on uncaught exceptions does not work because of missing support in node.
  • Debugging multiple processes (e.g. cluster) is cumbersome.

Getting Started

Requirements

  • node.js
    • version 0.8 or later
  • npm
  • A Blink-based browser (i.e. Google Chrome)

Install

  • With npm

      $ npm install -g node-inspector
    

Enable debug mode

To use node-inspector, enable debugging on the node you wish to debug. You can either start node with a debug flag like:

$ node --debug your/node/program.js

or, to pause your script on the first line:

$ node --debug-brk your/short/node/script.js

Or you can enable debugging on a node that is already running by sending it a signal:

  1. Get the PID of the node process using your favorite method. pgrep or ps -ef are good

     $ pgrep -l node
     2345 node your/node/server.js
    
  2. Send it the USR1 signal

     $ kill -s USR1 2345
    

Great! Now you are ready to attach node-inspector

Debugging

  1. start the inspector. I usually put it in the background

     $ node-inspector &
    
  2. open http://127.0.0.1:8080/debug?port=5858 in Chrome

  3. you should now see the javascript source from node. If you don't, click the scripts tab.

  4. select a script and set some breakpoints (far left line numbers)

  5. then watch the screencasts

For more information on getting started see the wiki

node-inspector works almost exactly like the web inspector in Chrome. Here's a good overview of the UI

Inspector options

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

FAQ / WTF

  1. My script runs too fast to attach the debugger.

use --debug-brk to pause the script on the first line

  1. I got the ui in a weird state.

when in doubt, refresh

  1. Can I debug remotely?

Yes. node-inspector must be running on the same machine, but your browser can be anywhere. Just make sure port 8080 is accessible

Thanks

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