Debugging Node

Debugging in JavaScript

Debugging Node

🙋 Need help? Ask an expert now!

As mentioned previously, JavaScript can also be debugged locally with Node.js. Node.js has it's own debugger that can be called using the inspect keyword. Here's how you will debug a JavaScript file:

  1. Open Terminal/CMD
  2. Navigate to the folder of the file to debug
  3. Run
node inspect filename.js
  1. You will then see the debugging screen. This is what you will be using later. Type control c twice and exit the debugger.
  2. Go back to your JavaScript file and add the statement debugger; to create a breakpoint
  3. Run step 3 again and a breakpoint will occur
Edit Me on GitHub!