Cannot find module "@discordjs/rest"

Whenever I try run any script that calls the discord.js library, I receive the following error:
Cannot find module "@discordjs/rest" from "/Users/[username]/Projects/discord-service/node_modules/discord.js/src/client/BaseClient.js"
Cannot find module "@discordjs/rest" from "/Users/[username]/Projects/discord-service/node_modules/discord.js/src/client/BaseClient.js"
I've reinstalled discord.js, but to no avail. I'm using the Bun runtime, if that's useful information.
8 Replies
d.js toolkit
d.js toolkit13mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
monbrey
monbrey13mo ago
Not sure we officially support bun. Is there a flag to also install dependencies that you need to set?
probablyraging
probablyraging13mo ago
I've ran a test instance of djs v14.11 in the past using the Bun runtime, had no issues and don't recall needing to do anything extra to get it working either. Haven't tried any later version of djs though
axindev
axindevOP13mo ago
I've tried it inside node v20.9.0 and I receive the same error, meaning it has nothing to do with the runtime.
monbrey
monbrey13mo ago
How exactly have you installed it? Nobody else is having this issue so it's unlikely to be the package You don't have a global install or something?
axindev
axindevOP13mo ago
It's installed locally to the project's node_modules folder I might init a fresh NPM project and copy my JS files over. That'll probably solve the problem.
monbrey
monbrey13mo ago
Yeah give that a try, definitely seems like something weird in that project
axindev
axindevOP13mo ago
update: it worked closing the thread now
Want results from more Discord servers?
Add your server