kurtosis
kurtosis
DIAdiscord.js - Imagine an app
Created by kurtosis on 8/24/2023 in #djs-questions
@discordjs/opus issue when rebuilding for electron
const { OpusEncoder } = require('@discordjs/opus')
...
/* decode raw OPUS packets into raw PCM/interleaved/signed-int16/little-endian data */
if (this.opusEncoder === null)
this.opusEncoder = new OpusEncoder(sampleRate, noChannels)
const decoded = this.opusEncoder.decode(buffer)
const { OpusEncoder } = require('@discordjs/opus')
...
/* decode raw OPUS packets into raw PCM/interleaved/signed-int16/little-endian data */
if (this.opusEncoder === null)
this.opusEncoder = new OpusEncoder(sampleRate, noChannels)
const decoded = this.opusEncoder.decode(buffer)
ERROR:
Uncaught Error Error: Cannot find module 'D:\Libraries\Documents\GitHub\tv-dinner\node_modules\@discordjs\opus\prebuild\electron-v25.7-napi-v3-win32-x64-unknown-unknown\opus.node'
Require stack:
- D:\Libraries\Documents\GitHub\tv-dinner\node_modules\@discordjs\opus\lib\index.js
- D:\Libraries\Documents\GitHub\tv-dinner\worker.html
at Module._resolveFilename (internal/modules/cjs/loader:1082:15)
at o._resolveFilename (electron/js2c/renderer_init:2:3879)
at Module._load (internal/modules/cjs/loader:927:27)
at f._load (electron/js2c/asar_bundle:2:13330)
at o._load (electron/js2c/renderer_init:2:3109)
at Module.require (internal/modules/cjs/loader:1148:19)
at require (internal/modules/cjs/helpers:110:18)
at <anonymous> (d:\Libraries\Documents\GitHub\tv-dinner\node_modules\@discordjs\opus\lib\index.js:5:18)
Uncaught Error Error: Cannot find module 'D:\Libraries\Documents\GitHub\tv-dinner\node_modules\@discordjs\opus\prebuild\electron-v25.7-napi-v3-win32-x64-unknown-unknown\opus.node'
Require stack:
- D:\Libraries\Documents\GitHub\tv-dinner\node_modules\@discordjs\opus\lib\index.js
- D:\Libraries\Documents\GitHub\tv-dinner\worker.html
at Module._resolveFilename (internal/modules/cjs/loader:1082:15)
at o._resolveFilename (electron/js2c/renderer_init:2:3879)
at Module._load (internal/modules/cjs/loader:927:27)
at f._load (electron/js2c/asar_bundle:2:13330)
at o._load (electron/js2c/renderer_init:2:3109)
at Module.require (internal/modules/cjs/loader:1148:19)
at require (internal/modules/cjs/helpers:110:18)
at <anonymous> (d:\Libraries\Documents\GitHub\tv-dinner\node_modules\@discordjs\opus\lib\index.js:5:18)
I rebuilt @discordjs/opus for electron using electron-rebuild and the app is searching for Opus.node in the wrong directory. The prebuild generated by the rebuild process is called .\node_modules@discordjs\opus\prebuild\electron-v25.7-napi-v3-win32-x64-unknown-{libc_version}. Meanwhile the app is searching in "unkown-unknown"
6 replies