Issue w/ Opus -> Ogg recording voice with [email protected] - ERR_REQUIRE_ESM
I was trying to follow this example recording voice demo (https://github.com/discordjs/voice-examples/blob/main/recorder/src/createListeningStream.ts#L19C1-L27C5), but I'm running into the following error:
I am using ESM instead of CommonJS (the example link uses CommonJS). As a result, despite prism being ESM compatible, an underlying part of it, e.g., node-crc seems to be using CJS. I'm not sure how to go about fixing this. Any ideas would be great. I was thinking of looking for another stream encoder for Opus -> Ogg but I haven't found any that work yet. Does anyone have advice for me? Thank you in advance.
Code will be pasted as a comment.
GitHub
voice-examples/recorder/src/createListeningStream.ts at main ยท disc...
A collection of examples of how to use @discordjs/voice in your projects - discordjs/voice-examples
6 Replies
- 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!
- โ
Marked as resolved by staffthe version of
node-crc
that example should be using uses cjs, yes
but your error indicates that node-crc
appears to be using esm, which is the case on newer major versions
please ensure that you haven't strayed from the example's dependencies
if your package.json looks correct, you may just need to reinstall depsThank you so much! That was my issue--my crc-node version was v3 when the documentation uses an older version. Also sending you nitro b/c that just saved me hours and hours
@duck Do you mind adding me or something so I can send you the link? I could put it here but then anyone can see it
or i can paste here quickly lol
I'm actually good, thanks
like everyone else helping, I'm just here as a volunteer
Ok! Well thank you so much, highlight of my day