Node Inspector is a debugger interface for Node.js applications that allows you to debug your code in a web browser. It is compatible with the following versions of Node.js:
- v0.10.x
- v0.12.x
- v4.x
- v5.x
- v6.x
- v7.x
- v8.x
- v9.x
- v10.x
- v11.x
- v12.x
- v13.x
- v14.x
To use Node Inspector, you need to install it globally using npm:
npm install -g node-inspector
Then, you can start the debugger by running the node-inspector
command and starting your Node.js application with the --debug
flag:
node-inspector &
node --debug your-app.js
This will start the debugger and open a new tab in your default web browser with the debugger interface. You can then set breakpoints, step through your code, and inspect variables as you would with any other debugger.
Note that Node Inspector may not work with some versions of Node.js due to changes in the debugger protocol. In these cases, you may need to use an alternative debugger, such as the built-in debug
module or the ndb
debugger.