Original Repo: https://github.com/node-inspector/node-inspector
npm install -g node-inspector
node-inspector &
Will prompt you to open http://127.0.0.1:8080/debug?port=5858
in Chrome.
node --debug app.js
debug the file, will break on debugger;
statements or existing break points. Only works with files that do not exit right away.
node --debug-brk app.js
debug the file, always break on first line of code.
Close the terminal tab or ps aux | grep node-inspector
to get process ID for node-inspector and sudo kill -9 <processID>
node-debug app.js
will:
- Start Node Inspector
- Open New Tab in Chrome
- Break on first line of code
Bonus: Use Command + o
shortcut in Chrome to open the file you want to debug
node-debug $(which grunt) test