Muffoi
Muffoi
DIAdiscord.js - Imagine an app
Created by Muffoi on 5/16/2025 in #djs-voice
Electron renderer crashes after importing @discordjs/voice
In my electron project I have the renderer set up as below:
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
sandbox: false,
devTools: !app.isPackaged
},
autoHideMenuBar: true
})

win.loadFile(resolve(__dirname, "../../static/index.html"));
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
sandbox: false,
devTools: !app.isPackaged
},
autoHideMenuBar: true
})

win.loadFile(resolve(__dirname, "../../static/index.html"));
Everything works fine until I run require("@discordjs/voice"); (also tried this in DevTools console), when the whole window turns black and DevTools says
DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.
I have looked at Electron docs and there it says that DevTools disconnecting signalizes a V8 crash. With --enable-logging Electron flag, the only thing printed out in console is:
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
generateDependencyReport() output:
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.18.0
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.10.0
- opusscript: not found

Encryption Libraries
- sodium-native: 5.0.3
- sodium: not found
- libsodium-wrappers: not found
- @stablelib/xchacha20poly1305: not found
- @noble/ciphers: not found

FFmpeg
- version: 7.1.1-full_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.18.0
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.10.0
- opusscript: not found

Encryption Libraries
- sodium-native: 5.0.3
- sodium: not found
- libsodium-wrappers: not found
- @stablelib/xchacha20poly1305: not found
- @noble/ciphers: not found

FFmpeg
- version: 7.1.1-full_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
How do I solve this?
6 replies