Cannot find module "discord.js"

I get this error eventhough discord.js is installed:

module.js:550
throw err;
^

Error: Cannot find module 'discord.js'

at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/index.js:1:79)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)

Try deleting line of this package from package.json and install it again using console:

pnpm install discord.js

This often happen when pnpm is not enabled for your project.
Go to your project page console and type out enable-pnpm and it will restart the project, installing all modules and fixing the problem.

Thanks so much, it worked!

1 Like

Glad To Help You Out.:blush:

2 Likes