Debugging Node.js Modules
To debug Node.js Modules, you need to have the Node.js runtime installed. You can typically check if Node.js is installed by running the
node command in Terminal/Command Prompt.
With a default installation, the IDEs will usually find the Node.js executable automatically, but the following topics will help you set up Node.js or point your IDE to a custom Node.js install:
- Setting up for Node.js Development with Fire on Mac
- Setting up for Node.js Development with Water on Windows
- Setting up for Node.js Development with Visual Studio on Windows
On launch, the IDE will automatically spin up a Node.js executable instance, and attach the debugger to it. This is controlled by the
<DebugNodeEntryPoint> setting, which specified the entry point .js file. The provided path name must be relative to the project output, eg. to the
./Bin folder, and will typically be pre-set by the project template.
Once your your Node.js application is launched, you can debug your code the same as you would any other project. For example, you can set Breakpoints to pause execution when a certain part of your code is hit, and you will automatically "break" into the debugger, if any Exception occurs.