#Error when tryin to play a song

1 messages · Page 1 of 1 (latest)

snow kiln
#

Node.js v20.9.0
Npm v10.2.4
error I get when trying to play a song

C:\Users\xxx\Desktop\Discord bot 5.0\events\Player\error.js:6
    .setAuthor({name: `Bot had an unexpected error, please check the console imminently!`, iconURL: track.thumbnail})
                                                                                                    ^

ReferenceError: track is not defined
    at module.exports (C:\Users\xxx\Desktop\Discord bot 5.0\events\Player\error.js:6:101)
    at _PlayerEventsEmitter.emit (node:events:514:28)
    at _PlayerEventsEmitter.emit (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\discord-player\dist\index.js:1110:18)
    at _GuildQueue.emit (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\discord-player\dist\index.js:3902:31)
    at _StreamDispatcher.<anonymous> (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\discord-player\dist\index.js:3913:38)
    at _StreamDispatcher.emit (node:events:514:28)
    at AudioPlayer.<anonymous> (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\discord-player\dist\index.js:1525:55)
    at AudioPlayer.emit (node:events:514:28)
    at OpusEncoder.onStreamError (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\discord-voip\dist\index.js:1122:14)
    at Object.onceWrapper (node:events:629:26)

was able to do npm install, BUT was NOT able to do "yarn install"
even after "npm install yarn" that gives me a whole other error, when someone has the time to help me out I would greatly apprentice it! Thanks!

#

update I ran this code in powershell "Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted"
and now i can yarn install, i deleted node modules and reinstalled them with yarn install which gave me this error

C:\Users\xxx\Desktop\Discord bot 5.0\events\Player\error.js:6
    .setAuthor({name: `Bot had an unexpected error, please check the console imminently!`, iconURL: track.thumbnail})
PS C:\Users\xxx\Desktop\Discord bot 5.0> yarn install
yarn install v1.22.21
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
[1/3] ⠂ @discordjs/opus
[2/3] ⠂ ffmpeg-static
error C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\@discordjs\opus: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\@discordjs\opus
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | win32 | x64
node-pre-gyp info check checked for "C:\Users\David\Desktop\Discord bot 5.0\node_modules\@discordjs\opus\prebuild\node-v115-napi-v3-win32-x64-unknown-unknown\opus.node" (not found)
node-pre-gyp http GET https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v115-napi-v3-win32-x64-unknown-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v115-napi-v3-win32-x64-unknown-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for @discordjs/[email protected] and [email protected] (node-v115 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v115-napi-v3-win32-x64-unknown-unknown.tar.gz
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd clean' (Error: spawn node-gyp.cmd ENOENT)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\@discordjs\node-pre-gyp\lib\util\compile.js:79:20)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
node-pre-gyp ERR! stack     at onErrorNT (node:internal/child_process:484:16)
node-pre-gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
node-pre-gyp ERR! System Windows_NT 10.0.19045
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xxx\\Desktop\\Discord bot 5.0\\node_modules\\@discordjs\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\@discordjs\opus
node-pre-gyp ERR! node -v v20.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.4.5
node-pre-gyp ERR! not ok

and i still get the same error when trying to play a song

snow kiln
#

when i run cmd and type ffmpeg

C:\Users\xxx>ffmpeg
ffmpeg version 2023-11-20-git-e56d91f8a8-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 32.100 / 58. 32.100
  libavcodec     60. 33.100 / 60. 33.100
  libavformat    60. 17.100 / 60. 17.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 13.100 /  9. 13.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

C:\Users\David>
glacial geyser
#

Hello ! The first error you sent (track is not defined) can be fixed with this: #1169081333411225600

#

Yarn is preferable to NPM bot both should work

snow kiln
#

nice, thank you. I got that fixed but I run into this error https://discord.com/channels/773639842449850368/1171422769087529011, even after a manual install of opus and the master branch of the normal music bot: https://github.com/ZerioDev/Music-Bot
the error on my end

lets play some music!
Error emitted from the Bot Cannot convert "undefined" to int
node:events:492
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot convert "undefined" to int
    at Object.toWireType (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\opusscript\build\opusscript_native_wasm.js:54:55)
    at OpusScriptHandler.OpusScriptHandler$_encode [as _encode] (eval at Db (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\opusscript\build\opusscript_native_wasm.js:36:242), <anonymous>:11:26)
    at OpusScript.encode (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\opusscript\index.js:69:28)
    at OpusEncoder._transform (C:\Users\xxx\Desktop\Discord bot 5.0\node_modules\@discord-player\opus\dist\index.js:197:29)
    at Transform._write (node:internal/streams/transform:175:8)
    at writeOrBuffer (node:internal/streams/writable:447:12)
    at _write (node:internal/streams/writable:389:10)
    at Writable.write (node:internal/streams/writable:393:10)
    at _VolumeTransformer.ondata (node:internal/streams/readable:817:22)
    at _VolumeTransformer.emit (node:events:514:28)
Emitted 'error' event on VolumeTransformer instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)