DEV Community

Discussion on: How to set up a Discord music bot (Updated December 2021)

 
galnir profile image
Nir • Edited

I think you are trying to import it in a wrong way, in your index.js file did you try to require("../../config.json")?

It should be only "config.json" if so

Thread Thread
 
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?

Thread Thread
 
galnir profile image
Nir • Edited

Um do you have a package.json file?
If you cloned mine just run npm install

Thread Thread
 
dgyh profile image
dgyh • Edited

Seems like the problem doesn't occur anymore. Now it has to display an error like this one:

Structures.extend('Guild', Guild => {
^

TypeError: Cannot read property 'extend' of undefined
at Object. (C:\Users\me\Downloads\sateenkaari\index.js:6:12)
[90m at Module._compile (internal/modules/cjs/loader.js:1128:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:983:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:891:14)[39m
[90m at Function.executeUserEntryPoint as runMain[39m
[90m at internal/main/run_main_module.js:17:47[39m

Thread Thread
 
galnir profile image
Nir

you probably did not install discord.js master, hit

npm i discordjs/discord.js