i am a new coder that trying to code a discord bot with discord js and run into some tutorials in Glitch.com hosting as well. But i seem to hit this error where discord.js is not found from my simple bot file
your package.json has an error (well, in Glitch it is counted as an error): your version field does not contain a valid semver. This is why the packages don’t get installed. You should set it to 1.0.0 (for example), and then the packages will be installed. If you scroll up in the Logs, you’ll see that this error is reported.
In the above scenario, you go into the package.json file and change the value alongside ‘version’ to 1.0.0. However, there are a few potential causes of this problem, so if that doesn’t fix it then provide your project name and we can take a look for you.
Hi, I’m having a similar issue.
Error: Cannot find module ‘discord.js’
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object. (/app/server.js:1:79)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
C:\Users\Eli\Desktop\NinjaBot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\Eli\Desktop\NinjaBot\index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [ ‘C:\Users\Eli\Desktop\NinjaBot\index.js’ ]
}