I am looking at the docs for
$ node --debug
$ node debug
It's already explained in the documentation you linked to, under Advanced Usage:
An alternative way of enabling and accessing the debugger is to start Node.js with the --debug command-line flag or by signaling an existing Node.js process with SIGUSR1.
Once a process has been set in debug mode this way, it can be inspected using the Node.js debugger by either connecting to the pid of the running process or via URI reference to the listening debugger:
node debug -p <pid> - Connects to the process via the pid node debug <URI> - Connects to the process via the URI such as localhost:5858
So in short,
--debug (or SIGUSR1) explicitly enables the (V8) debug server and begins listening for debugger connections. Executing
node debug localhost:5858/
node debug -p 12345 then causes node's built-in command line debugger to connect to that particular process.
node debug foo.js is just a way to combine the two steps: enabling the debug server and then automatically connecting to it.