[SOLVED] Module.js:550 throw err; ^ Error: Cannot find module 'discord.js'

module.js:550

8:35 PM

throw err;

8:35 PM

^

8:35 PM

8:35 PM

Error: Cannot find module ‘discord.js’
No time to do anything just copy pasting things

1 Like

Go to your package.json file
Click “add package”
Type in discord.js
Click the top result
And it shouldn’t error anymore

Hello there,

You need to install a package before requiring/using it.
There are a few methods to install packages on Glitch:

  • Open to package.json file, present in the app (root) directory. Once you’ve opened package.json file, click on “Add Package” and type the package name in the search field. Browse through the list and select the desired package, you want to install.
  • Open package.json file, present in the app (root) directory. Once you’ve opened package.json file, add the following element to the dependencies field and restart your app.
"dependencies": {
    "package-name-here": "version"
}
  • Open the console of the Glitch app, run npm install package-name to install the package. Restart your app and it should be installed.

Hope this helps and happy glitching!

there is still
I have tried most of things

image
Still now good check it out
edit: That aint the correct name

Could you enter your console and run pnpm install ? It should re-install all the packages

It would be much easier if you could DM me an invite to your app/project, so I can take a closer look into it. Furthermore, @SpeedyCraftah, I am not sure why did you presume that he has pm2 integrated.

-su: pm2: command not found
this is the error no idea what i should do

Please refrain from misguiding users!
I know that everyone should be able to comment on topics, but that can confuse users.

dmed you did you got it?

Oh I meant to say pnpm install haha

1 Like

Since the error was resolved, changed the title to [SOLVED] Module.js:550 throw err; ^ Error: Cannot find module 'discord.js'