I am getting errors of this part of code const Discord = require("discord.js"); what happened?
- did you do npm i discord.js
- try to lowercase the d in Discord
Yes I did, it’s still not working
What is the error
Can you copy can paste the full errors here please?
internal/modules/cjs/loader.js:613
11:26 AM
throw err;
11:26 AM
^
11:26 AM
11:26 AM
Error: Cannot find module ‘discord.js’
11:26 AM
Require stack:
11:26 AM
Jump To- /app/index.js
11:26 AM
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
11:26 AM
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
11:26 AM
at Module.require (internal/modules/cjs/loader.js:666:19)
11:26 AM
at require (internal/modules/cjs/helpers.js:16:16)
11:26 AM
Jump Toat Object. (/app/index.js:1:17)
11:26 AM
at Module._compile (internal/modules/cjs/loader.js:759:30)
11:26 AM
at Object.Module._extensions…js (internal/modules/cjs/loader.js:770:10)
11:26 AM
at Module.load (internal/modules/cjs/loader.js:628:32)
11:26 AM
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
11:26 AM
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
11:26 AM
a few seconds ago
internal/modules/cjs/loader.js:613
11:26 AM
throw err;
11:26 AM
^
11:26 AM
11:26 AM
Error: Cannot find module ‘discord.js’
11:26 AM
Require stack:
11:26 AM
Jump To- /app/index.js
11:26 AM
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
11:26 AM
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
11:26 AM
at Module.require (internal/modules/cjs/loader.js:666:19)
11:26 AM
at require (internal/modules/cjs/helpers.js:16:16)
11:26 AM
Jump Toat Object. (/app/index.js:1:17)
11:26 AM
at Module._compile (internal/modules/cjs/loader.js:759:30)
11:26 AM
at Object.Module._extensions…js (internal/modules/cjs/loader.js:770:10)
11:26 AM
at Module.load (internal/modules/cjs/loader.js:628:32)
11:26 AM
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
11:26 AM
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
Could you please try executing the follow command-
npm cache cean --force
? If this does not work, please try executing these commands-
rm shrinkwrap.yaml
enable-pnpm
.
didnt work
cool, what does that do?
If you have dbl installed try uninstalling it.
I dont have dbl installed
Which one?
I did both the commands you said but still didn’t work
Hi @EfazDev!
Have you added the package through the package.json file?
Have a look how on this help article/video:
You should add the package
discord.jsIf you need any more help, feel free to send another post!
Eddie
I did add the discord.js package
But if I reinstall it, it makes a error
pnpm install discord.js --save
What about that? npm has not been working for me, so i just use pnpm!
Still not working
How about you look in to it https://glitch.com/edit/#!/em-server-bot-test-1?path=main.js%3A1%3A0 Reply if you know why
Try reinstalling all Module.
First of all, Remove node_modules Folder by executing rm -rf node_modules at Terminal. Then, Do npm install.
Tell me if this helps you out.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.