DEV Community

Cover image for How to set up a Discord music bot (Updated December 2021)
Nir
Nir

Posted on • Updated on

Music Bot for Discord How to set up a Discord music bot (Updated December 2021)

Setting up a music bot isn't easy since it requires lots of different things to be installed. In this guide I will list all the requirements and provide you with the code you need. Make sure you follow all the steps :)

Let's start!

Create a bot

First we need to create the bot, go here and make sure you're logged in. Click on New Application and give your bot a name.
Go to the "Bot" tab on the left and click Add Bot under the "BUILD-A-BOT" tab. Copy the token and save it because we will need it for later.
Copy the Application ID under the "General Information" tab and save it for later as well.

Now click on the "OAuth2" tab and then on "URL Generator". Under "Scopes", check "bot" and on "applications.commands". Under "Bot Permissions", check "Administrator". Now copy the URL under "Generated URL" and paste it into your browser in order to invite your newly created bot to your Discord server!

Code Editor

A code editor let's us write and modify code. The code editor I use and recommend is Visual Studio Code.
You can also use other great editors like Sublime Text and Atom.

Node.js and npm

Node.js is a JavaScript runtime. It basically lets us run JavaScript code on our machine. We also use its package ecosystem, npm, which we will discuss next.
Download Node.js from its official website (LTS or latest).
To check if you installed it correctly, open your terminal(cmd or bash depending on which OS you are using), and run node -v, you should get a number back. If you're struggling with installing Node, check out this guide.
nom comes installed with Node.js, we will use npm later to install dependencies.

Git

Git is an open source version control system. It helps developers to manage projects by keeping track of the entire history of a project and makes it easy to add features without worrying about breaking the entire codebase. We will use Git in order to obtain code for our bot from GitHub. GitHub is a hosting service for Git repositories. You can learn more about Git and Github from this superb article.

If you're on Windows, install Git from here. For macOS users, install Xcode and then hit git --version, it'll prompt you to install it. If you're using Linux based OS, hit sudo dnf install git-all or sudo apt install git-all for debian.

Java 13

Download Java 13 from here, make sure you download the correct one for your Operating System.

Cloning the repository

Go to your terminal(cmd, git bash or bash), you probably see on the left that you are now in your user folder(C:\Users/"username"). Enter cd Desktop to go to your Desktop. Then 'git clone https://github.com/galnir/Master-Bot'. You are cloning(copying) the repository from GitHub so you can use its code.

Getting Lavalink

Download the latest Lavalink jar file from here (under assets). Place the jar file in the root directory of the project (same folder as index.js and package.json)

Application.yml

Create a file named application.yml in the same folder you placed the jar file from before. Copy everything from this example to your application.yml

Tokens

For everything to function we need the following tokens:

  • The bots discord ID (saved from the first section)
  • The bots token (saved from the first section)
  • A Spotify client ID
  • A Spotify client secret

In order to generate the last 2 tokens you need to create a Spotify account and login to the dev dashboard
After you login, simply create an app and copy the client ID and secret.

Config.json

In the root directory of the project create a file named config.json and have it look like this:

{
  "client_id": "the-bots-discord-id",
  "token": "Your-Bot-Token",
  "lava_host": "0.0.0.0",
  "lava_pass": "youshallnotpass",
  "spotify_client_id": "get-it-from-spotify-dev",
  "spotify_client_secret": "get-it-from-spotify-dev"
}
Enter fullscreen mode Exit fullscreen mode

Put every token you generated in its place surrounded by quotes

Running the bot

Open a terminal in the root directory of the project and run java -jar Lavalink.jar.
Now open another terminal instance in the same folder and run node index.js

After running both commands you should be able to run music commands using the new Slash feature! Simply type / in a text channel and you should see the command list!

If you have any questions/issues you can comment here or open an issue in the repo. Also don't forget to leave a star in the repo if you found it helpful :)

Bot Repo: https://github.com/galnir/Master-Bot
Cover image by Malte Wingen :)

Top comments (73)

Collapse
 
leonida18351756 profile image
Leonidas

Can you help me?

(node:9104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see nodejs.org/api/cli.html#cli_unhand...). (rejection id: 1)
(node:9104) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thats the error i get. Tried some trouble shooting, but didnt work. Also i dont hear any sound when my bot joins the channel... Is both the same problem or whats happening here? Pls help me, thanks.

Collapse
 
saibhargavsankoji profile image
Sai Bhargav Sankoji

Hey i have the same error. Could you please help me

Collapse
 
galnir profile image
Nir

Check again if you installed everything listed here, if something is missing it's not gonna work

Collapse
 
leonida18351756 profile image
Leonidas

Yes. I did everything like you said on top of this Blog. I followed every single step.

Collapse
 
madmouseked profile image
Madmouseked

Hey, I tried a few things and I can't get the thing to run npm install properly.
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:302:5)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\MadmouseKed\Desktop\Erika-Bot\Master-Bot\node_modules\node-opus
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN discord.js-commando@0.11.0-dev requires a peer of @types/better-sqlite3@5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of discord.js@12.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of sqlite@3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN master-bot@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ref@1.3.5 (node_modules\ref):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ref@1.3.5 install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-opus@0.3.2 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-opus@0.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MadmouseKed\AppData\Roaming\npm-cache_logs\2019-12-03T15_45_58_318Z-debug.log

Hope you can help me out,
Thanks!
-Ked

Collapse
 
galnir profile image
Nir

According to stackoverflow it might be due to c++ build tools not being installed.
Take a look at this stackoverflow.com/questions/575414...

Collapse
 
dungcan profile image
DungCan

internal/modules/cjs/loader.js:800
throw err;
^

Error: Cannot find module 'C:\Users\Truong Anh\Desktop\bot\index.js'
?[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797
:15)?[39m
?[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)?[39m
?[90m at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)?[39
m
?[90m at internal/main/run_main_module.js:17:11?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
requireStack: []
}

this is my trouble errors . help me please !!

Collapse
 
galnir profile image
Nir

Have you installed everything I listed?

Collapse
 
dungcan profile image
DungCan • Edited

yes . i installed all thing in this post . but i use python 3.7.0 :/

Thread Thread
 
galnir profile image
Nir

Install 2.7 then

Collapse
 
thekidwunder profile image
WunderKid • Edited

Error: Could not find an Opus module! Please install node-opus or opusscript.
at new OpusStream (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\prism-media\src\opus\Opus.js:41:13)
at new Decoder (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\prism-media\src\opus\Opus.js:163:1)
at AudioPlayer.playOpusStream (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:79:23)
at VoiceConnection.play (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:74:28)
at VoiceConnection.onSessionDescription (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\discord.js\src\client\voice\VoiceConnection.js:455:29)
at VoiceWebSocket.emit (events.js:198:13)
at VoiceWebSocket.onPacket (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\discord.js\src\client\voice\networking\VoiceWebSocket.js:188:14)
at VoiceWebSocket.onMessage (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\discord.js\src\client\voice\networking\VoiceWebSocket.js:139:19)
at WebSocket.onMessage (C:\Users\WunderKid\Desktop\Master-Bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:198:13)

Collapse
 
galnir profile image
Nir

Did you install node-opus?

npm install node-opus

Collapse
 
happyman001144 profile image
Happyman001144

I get an error when I try to install node opus. Can you suggest what I should do?

node-opus@0.3.3 install C:\Users\georg\Downloads\Master-Bot\node_modules\node-opus

node-gyp rebuild

C:\Users\georg\Downloads\Master-Bot\node_modules\node-opus>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\georg\AppData\Local\Programs\Python\Python38-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\georg\Downloads\Master-Bot\node_modules\node-opus
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN discord.js@12.0.0-dev requires a peer of @discordjs/uws@11.149.1 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@12.0.0-dev requires a peer of bufferutil@4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@12.0.0-dev requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@12.0.0-dev requires a peer of libsodium-wrappers@0.7.4 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@12.0.0-dev requires a peer of sodium@3.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@12.0.0-dev requires a peer of zlib-sync@0.1.4 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@12.0.0-dev requires a peer of zucc@0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of @types/better-sqlite3@5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of discord.js@12.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of sqlite@3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN prism-media@1.1.0 requires a peer of opusscript@0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN master-bot@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-opus@0.3.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-opus@0.3.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\georg\AppData\Roaming\npm-cache_logs\2019-10-30T20_20_37_834Z-debug.log

Thread Thread
 
galnir profile image
Nir

You are using python version 3.x and it requires python version 2.7

Collapse
 
damixadkatakara profile image
damixadkatakara • Edited

hi i have a error

  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17) at Function.Module._load (internal/modules/cjs/loader.js:686:27) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (c:\Users\imady\OneDrive\Desktop\bot-final.edition\index.js:1:28) at Module._compile (internal/modules/cjs/loader.js:952:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)

end i have a error whit NPM code
extract: WARN tar ENOENT: no such file or directory, open 'C:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules.staging\@babel\types-

Collapse
 
galnir profile image
Nir

Did you install all the dependencies and other requirements?

Collapse
 
damixadkatakara profile image
damixadkatakara

ok i managed to settle my problem with friend but a new problem is before us
debugger listening on ws://127.0.0.1:4777/7ce98a6d-7418-49f0-acae-6553fff29399
For help, see: nodejs.org/en/docs/inspector

Debugger attached.
WaitingError: Cannot find module '../../config.json'
Require stack:

  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\commands\gifs\animegif.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\require-all\index.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\discord.js-commando\src\registry.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\discord.js-commando\src\client.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\discord.js-commando\src\index.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) at Function.Module._load (internal/modules/cjs/loader.js:862:27) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (c:\Users\imady\OneDrive\Desktop\bot-final.edition\commands\gifs\animegif.js:2:22) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) for the debugger to disconnect...
Thread Thread
 
damixadkatakara profile image
damixadkatakara

debugger listening on ws://127.0.0.1:33350/4b02f0da-9828-4ed9-a1cd-5ba111b9b611
For help, see: nodejs.org/en/docs/inspector
Debugger attached.
Waiting foError: Cannot find module '../../config.json'
Require stack:

  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\commands\gifs\animegif.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\require-all\index.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\discord.js-commando\src\registry.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\discord.js-commando\src\client.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\node_modules\discord.js-commando\src\index.js
  • c:\Users\imady\OneDrive\Desktop\bot-final.edition\index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) at Function.Module._load (internal/modules/cjs/loader.js:862:27) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (c:\Users\imady\OneDrive\Desktop\bot-final.edition\commands\gifs\animegif.js:2:22) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) r the debugger to disconnect...

is its this is the new error code

Collapse
 
pagonasp3 profile image
PagOnASp

throw err;
^

Error: Cannot find module 'C:\Users\pagonasp\Desktop\New folder (2)'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint as runMain
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Collapse
 
joshuaih03 profile image
joshua.ihns

Can you help me?

throw err;
^

SyntaxError: C:\Master-Bot-master\config.json: Unexpected token / in JSON at position 24
at parse ()
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1192:22)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (C:\Master-Bot-master\index.js:4:27)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)

don't know how to fix this... :(

Collapse
 
galnir profile image
Nir

You didn't place an api key correctly in config.json

Collapse
 
enigma profile image
Enigma • Edited

I have a problem when I run npm install in command prompt, it shows me this:

Collapse
 
enigma profile image
Enigma
Collapse
 
enigma profile image
Enigma

nvm, i fixed that but i have another problem

Collapse
 
grantttt profile image
grantttt

hey may i know how you fixed that?

Thread Thread
 
enigma profile image
Enigma

it's been 6 fucking months

Thread Thread
 
grantttt profile image
grantttt

lol i just saw this thread

Collapse
 
mostafa12a profile image
MOSTAFA12A

PS C:\Users\roke\Desktop\igdj> npm i node-opus
npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.
npm ERR! code 1
npm ERR! path C:\Users\roke\Desktop\igdj\node_modules\node-opus
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.2.0
npm ERR! gyp info using node@16.9.1 | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\roke\AppData\Local\Programs\Python\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\roke\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python 3
npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python github.com/nodejs/node-gyp#install...
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (C:\Users\roke\Desktop\igdj\node_modules\node-gyp\lib\find-python.js:330:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (C:\Users\roke\Desktop\igdj\node_modules\node-gyp\lib\find-python.js:159:21)
npm ERR! gyp ERR! stack at PythonFinder. (C:\Users\roke\Desktop\igdj\node_modules\node-gyp\lib\find-python.js:228:18)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (C:\Users\roke\Desktop\igdj\node_modules\node-gyp\lib\find-python.js:294:16)
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:404:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19041
npm ERR! gyp ERR! command "C:\Users\roke\Desktop\igdj\node_modules\node\bin\node.exe" "C:\Users\roke\Desktop\igdj\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\roke\Desktop\igdj\node_modules\node-opus
npm ERR! gyp ERR! node -v v16.9.1
npm ERR! gyp ERR! node-gyp -v v8.2.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\roke\AppData\Local\npm-cache_logs\2021-09-26T13_47_14_392Z-debug.log

Collapse
 
nvptvjp profile image
NVPTVJP

help me plz beg u
Error: Cannot find module 'timers/promises'
Require stack:

  • C:\Users\kgev\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js
  • C:\Users\kgev\node_modules\@discordjs\rest\dist\lib\RequestManager.js
  • C:\Users\kgev\node_modules\@discordjs\rest\dist\index.js
  • C:\Users\kgev\index.js ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:745:27)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:961:19)←[39m ←[90m at require (internal/modules/cjs/helpers.js:92:18)←[39m at Object. (C:\Users\kgev\node_modules\←[4m@discordjs←[24m\rest\dist\lib\handlers\SequentialHandler.js:6:20) ←[90m at Module._compile (internal/modules/cjs/loader.js:1072:14)←[39m ←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)←[39m ←[90m at Module.load (internal/modules/cjs/loader.js:937:32)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:778:12)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:961:19)←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [ ←[32m'C:\Users\kgev\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js'←[39m, ←[32m'C:\Users\kgev\node_modules\@discordjs\rest\dist\lib\RequestManager.js'←[39m, ←[32m'C:\Users\kgev\node_modules\@discordjs\rest\dist\index.js'←[39m, ←[32m'C:\Users\kgev\index.js'←[39m ] }
Collapse
 
therealmaestro profile image
TheRealMaestro

Hey I need help, done all you said and getting an error when I try to do node index.js

throw err;
^

Error: Cannot find module 'timers/promises'
Require stack:

  • C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js
  • C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\lib\RequestManager.js
  • C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\index.js
  • C:\Users\Oringe\Desktop\Master-Bot\index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.Module._load (internal/modules/cjs/loader.js:745:27) at Module.require (internal/modules/cjs/loader.js:961:19) at require (internal/modules/cjs/helpers.js:92:18) at Object. (C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js:6:20) at Module._compile (internal/modules/cjs/loader.js:1072:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) at Module.load (internal/modules/cjs/loader.js:937:32) at Function.Module._load (internal/modules/cjs/loader.js:778:12) at Module.require (internal/modules/cjs/loader.js:961:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js', 'C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\lib\RequestManager.js', 'C:\Users\Oringe\Desktop\Master-Bot\node_modules\@discordjs\rest\dist\index.js', 'C:\Users\Oringe\Desktop\Master-Bot\index.js' ] }

Please and thank you

Collapse
 
dungcan profile image
DungCan

internal/modules/cjs/loader.js:305
throw err;
^

Error: Cannot find module 'C:\Users\Truong Anh\Desktop\bot1\index.js'. Please verify that the package.json has
a valid "main" entry
?[90m at tryPackage (internal/modules/cjs/loader.js:297:19)?[39m
?[90m at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)?[39m
?[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:784:27)?[39m
?[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)?[39m
?[90m at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)?[39m
?[90m at internal/main/run_main_module.js:17:11?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
path: ?[32m'C:\Users\Truong Anh\Desktop\bot1\package.json'?[39m,
requestPath: ?[32m'C:\Users\Truong Anh\Desktop\bot1'?[39m
}

this is my trouble error
any suggestions to help me?

Collapse
 
justreallyquick profile image
sav

im struggling so much here, i cannot figure out what this error means or what im supposed to do to fix it... it just keeps saying "Error: Cannot Find Module" when i try to do node index.js it just keeps saying that.

Collapse
 
suprx44 profile image
SupRx44

Same. Big thanks to the author, eh... wow rolls eyes

Collapse
 
bennett_rivers_393fd162f6 profile image
Bennett Rivers

I keep getting this error when running a play command through discord

An error occurred while running the command: TypeError: Cannot read property 'length' of undefined
You shouldn't ever receive an error like this.
Please contact the bot owner.

I have ffmpeg, python, and git all installed, so I don't know what I did wrong.

Collapse
 
shamithoysal profile image
shamithoysal

Heyo! Absolutely LOVED the post. It worked perfectly. I just wanted to know if I could edit the help command? I would do that because as I build up on this bot, I can add to the help command. Thanks in advance!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.