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

11,824

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

Share:
11,824
112madgamer
Author by

112madgamer

BY DAY: Sit at school not learning programming BY NIGHT: Sit and learn programming :)

Updated on June 18, 2022

Comments

  • 112madgamer
    112madgamer almost 2 years

    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

  • 112madgamer
    112madgamer about 6 years
    My current launcher for vscode is this { "type": "node", "request": "launch", "name": "Launch Program", "program": "${workspaceFolder}/Shards.js" } I dont see what you said can fix it?
  • Mahesh G
    Mahesh G about 6 years
    Can you try killall node this will kill all the running node sever and start directly debugging
  • Mahesh G
    Mahesh G about 6 years
    Are you using Chrome debugger or VS Code Debugger
  • 112madgamer
    112madgamer about 6 years
    VS Code Debugger
  • Mahesh G
    Mahesh G about 6 years
    Okay not sure even I was facing the same issue but killing node and directly running debug solved my problem!!
  • 112madgamer
    112madgamer about 6 years
    Issue related to this is here github.com/discordjs/discord.js/issues/1714