When your program doesn’t run the way you expect, debugging is a powerful way to gain insight into your program’s behavior.
The easiest way to debug with node.script is with a remote debugger — a program that attaches to the Node script and provides a debugging interface. When node.script is run with debugging enabled, you will be able to set breakpoints in your code. If the program encounters a breakpoint while it’s running, it will pause and allow you to inspect the state of local variables and see the full function call stack.
In order to do remote debugging, you’ll need to choose an inspector client, and you’ll need to enable remote debugging for the node.script object in your Max patch. Options for inspector clients include the Google Chrome Browser, or an IDE like VS Code. For a full list refer to the official Node JS Guide on Debugging .
Enabling Remote Debugging
There are two options for starting remote debugging, each of which has optional host and port parameter (host:port)
Theoption simply enables the remote debugging capabilities on your Node Program and allows you to attach the debugger at any point.
By comparison, theoption “breaks” the program at startup, halts the execution, and waits for a remote debugger to attach itself and run the program. This can be useful when you are debugging code that runs at startup of the program.
Specifying a port when enabling debugging is optional — the default port is 9229.
Important: It is not recommended to enable remote debugging on a host other than 127.0.0.1 (localhost) in order to prevent others from attaching and executing code within your Node context.
|Node For Max Documentation - Table of Contents||Node For Max Documentation - Table of Contents|
|Node For Max - Starting and Stopping||Node For Max - Starting and Stopping|