Error: Unable to launch the bot

Hello,
So I’m hosting a bot on glitch and recently having this error when trying to run “node bot” to start my bot :confused:

$ node bot

events.js:170
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1259:14)
    at listenInCluster (net.js:1307:12)
    at Server.listen (net.js:1395:7)
    at Function.listen (/rbd/pnpm-volume/bc28e445-43e6-4504-bca7-501d3e74f986/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/app/bot.js:15:5)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
Emitted 'error' event at:
    at emitErrorNT (net.js:1286:8)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:56:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:880:11)
    at internal/main/run_main_module.js:21:11 

My name project is: linkoss-bot

Thanks for your help!

This is because your bot is already running. Glitch automatically runs the server.js file (or any file set in package.json).

Yes but, I have a command that shut it and do node bot.js (aka a restart cmd) but it throw that error

It throws the error because the code is already running.

Can you please send me an edit link of your bot?

Your restart command can rather use this: process.exit(1);

2 Likes

Can you please DM me an edit link?