--inspect-brk flag and open Chrome DevTools, what happens immediately after the script starts?node --inspect-brk script.js
brk part in --inspect-brk means.The --inspect-brk flag tells Node.js to start the debugger and pause execution on the first line of the script. This allows you to set breakpoints or inspect variables before any code runs.
The Node.js inspector listens on a WebSocket URL starting with ws:// by default on port 9229. This is how Chrome DevTools communicates with the Node.js process.
node --inspect=localhost:9230 app.js but Chrome DevTools fails to connect. What is the most likely reason?By default, Chrome DevTools connects to port 9229 for Node.js debugging. If you specify a different port like 9230, you must manually tell DevTools to connect to that port. Otherwise, it will fail to connect.
When you pause execution in Chrome DevTools, the entire Node.js event loop is paused. This means no asynchronous callbacks, timers, or I/O events will run until you resume the script.
For Chrome DevTools to map breakpoints from JavaScript back to TypeScript, source maps must be generated during compilation and properly linked in the JavaScript files. Without source maps, DevTools only sees the compiled JS.