Chrome DevTools: Debug Node.js code using remote debugging
Last updated: 21st December 2018Did you know tools like Node Inspector or Iron Node can be used to debug your node.js code?
Using Node Inspector as an example (npm install -g node-inspector
), instead of running:
node index.js
You can run this instead:
node-debug index.js
In the example, I then go to a special DevTools URL: http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
which gives access to DevTools features for Node. You can set breakpoints, evaluate new JavaScript code in the Node.js context, collect heap snapshots & even live-edit JavaScript.