When you are working on any programing languages or frameworks, what you need to take care that is how to debug it while developing. And lucky for us, NodeJS has powerful debugging features build in, which is very helpful.
To start NodeJS debugger, you run the command below:
$ node inspect app.js < Debugger listening on ws://127.0.0.1:9229/15049088-2c78-4704-b145-80c635667b4b < For help, see: https://nodejs.org/en/docs/inspector < Debugger attached. Break on start in app.js:1 > 1 console.log("Hi") 2 debug>
For now, you can do many commands here to debug the NodeJS script
app.js, for example, you type
help command to list all functions of debugger:
- If you want set a breakpoint, you need to use
- If you want reset a breakpoint, you need to use
- List all breakpoints with
You should try almost commands which you want from your script and see the result. Thanks for reading!