Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS debug Starting inspector on 127.0.0.1:42457 failed: address already in use error

I am trying to debug my Discord bot using the DiscordJS lib. My trouble is that when I start a debug session (launching with vscode or with --inspect-brk | --debug-brk)

I get a Starting inspector on 127.0.0.1:42457 failed: address already in use error I have tried changing the port in both situations and still getting the same error on different ports. My bot is sharded so its start child process of itself. I have tried using vscode to attach to child processes but still the same error.

If anybody is familiar with DiscordJS and knows how to debug a sharded bot some help would be much appreciated

like image 287
112madgamer Avatar asked Feb 11 '18 04:02

112madgamer


1 Answers

In my case to solve this, just add that config on nodemon.json

{
 "execMap": {
  "js": "node --inspect=9300 -r sucrase/register"
  }
}

I added --inspect=9300 to set port to this specific port

like image 163
xbral Avatar answered Nov 09 '22 03:11

xbral