debugging a node.js javascript application

With node.js internet applications can be developed in a quick manner. The programs are written in javascript. They do not run on a web server. Programs are server-side javascript applications. The bigger your application gets the more tools one wishes to have for debugging (setting break points, step through/over parts of the code, etc.).
1 answer

Debugging javascript applications running on node.js with node-inspector

node-inspector is a great tool for debugging node.js javascript programs. Normally you need to restart your program if you make any changes in the code. With node-inspector all changes (if saves within node-inspector) are present in the running instance without restarting your node.js environment.
Here is a small step-by-step guide for installing node-inspector (I assume that node.js is already installed).

  • Use npm (a package manager which is included in node.js) to fetch and install the tool with:
    sudo npm install node-inspector
  • Start your program
    node --debug myprogram.js
  • Start node-inspector
    node-inspector &
  • Point chrome/chromium/safari (does not work with firefox) to
    http://127.0.0.1:8080/debug?port=5858

    Another method if your node.js application is already running is to send him a signal with the PID number to activate the debugging in node.js

    kill -s USR1 (pid of the node.js instance)

    Here is a link to the screencast from the developer of node-inspector.
    https://github.com/dannycoates/node-inspector/wiki/Screencast-Series