I was cleaning up my help command and for some reason my main server.js file logged an error of not being able to find the discord.js module, I have tried refreshing through the terminal and enable-pnpm and its still not fixed, its been like this for over 2 hours and it has caused my bot to go offline. Any one got any ideas on how I can fix this please?.
Hey @NoahsArkOfficial,
Does running enable-pnpm
in the console solve the issue?
no, ive tried that several times. I have also tried npm install discord.js but still the same issue. Ive updated node but now its not finding the module discord.js but its telling me required stack within that error message
Is the project public, so we could take a look at it? If you’re not comfortable sharing the code, could we see the contents of the package.json
file?
Try removing the line that says "node.js": "^0.0.0",
ive removed that, i hadnt noticed that was there. although it still sends back this
Hm are there any errors during the install process? Usually there’s a package that’s failing to install, so the install process aborts
do you want me to install discord.js again and send what it shows?
Sure, just seeing whether there’s any errors when you’re installing discord.js
or after you change package.json
and all the packages get installed
It would be helpful to take a look at the whole project, but I understand if it’s private for a reason
Strange, I don’t know why that’s happening. The only thing I can point to is what looks like a very old version of npm (v2.15.12)? Maybe try running npm -v
in the console and seeing whether you’re really on such an old version (newest is 6.something
).
Also, try remixing the project and seeing if you run into the same issues.
thats weird, last time i knew i was using v6.x. not sure when it dropped me down to v2.x, i tried remixing and im receiving this
Try running enable-pnpm
and pnpm install
in the console of the remixed project. If that doesn’t work, then maybe try running npm install
?
thats put me back to v6.x although it still cannot find discord.js.
weird, and running npm install discord.js@latest
doesn’t install it?
Hm, I don’t know anymore then. Looks like an issue with the integer
package, which is being required by another package (but I don’t know which one)
what does that mean?
So the npm packages you install can “require” (install) other packages, just like you would. If I make a package, I can use other packages in mine, and when you install my package it also installs the ones I need to make my package work.
It looks like the error is coming from a command that the package integer
is calling, "node-gyp rebuild"
(you see this near the bottom right above Exit status 1
. The error at the top of the screenshot (make failed with exit code: 2
) originates from node-gyp
, which lines up with it being integer
's fault (you can see that in the filename where the error is coming from).
However, you’re didn’t install integer
yourself, so I assume it’s needed for one of the packages you did install. But I don’t know which one, so I’m not really sure how to fix this
ah okay, would it be possible to see which one if you were shared into it?
I can’t promise, but it would be easier to debug if I could remix the project and try! My Glitch username is benborgers
i have a link pending approval atm, it doesnt contain my token and whatnot so it should be okay?
I got your project to work! I made a remix of your project and edited my remix, not the original you shared with me.
You have a lot of lot of packages installed in package.json
that you never use. I removed these packages from package.json
(delete the line where the package is referenced).
canvas
chalk
-
fs
(this is a built in module with Node.js, you don’t have to install it) mongodb
node-opus
opusscript
require-all
simple-youtube-api
ytdl-core
I found which packages you weren’t using by going down the list in package.json
and then searching the project (command+shift+F) to see if they were used in the code anywhere.
Then, there were packages that you were trying to use but you hadn’t installed. These included discord.js-commando
and scrambo
, so I installed those in the Glitch editor by going to package.json
and using the Add Package button at the top.
Then, open the console and run:
enable-pnpm
pnpm install
refresh
oh, it worked. I didn’t think about the packages that I weren’t using nor did I realise that I had packages missing. Thank you for helping me.
You’re welcome! Glad it works now