admin管理员组

文章数量:1387419

  • MacOS
  • WebStorm
  • Docker
  • Node 20.18.0
  • Nest 11.0.5

I'm running my NestJS application with the following command:

nest start --debug 0.0.0.0:9229 --watch

Whenever I make changes to a file, the process restarts as expected. However, it seems like the previous debugger instance doesn’t fully disconnect before the new one starts.

As a result, on every odd-numbered change, the debugger fails with:

Starting inspector on 0.0.0.0:9229 failed: address already in use

Then, on the next (even-numbered) change, it connects successfully:

Debugger listening on ws://0.0.0.0:9229/125a0c3c-c6d2-4f1e-b5eb-fbe109676996

It looks like the debugger is taking a bit too long to release the port before the next instance starts.

How can I ensure the debugger properly disconnects before restarting, so it consistently attaches every time?

本文标签: nodejsNestJSdebug with watch modeport taking too long to get releasedStack Overflow