Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@discordjs/opus does not support nodejs versions > v18.18.2 #147

Open
Caredas opened this issue Oct 26, 2023 · 13 comments
Open

@discordjs/opus does not support nodejs versions > v18.18.2 #147

Caredas opened this issue Oct 26, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@Caredas
Copy link

Caredas commented Oct 26, 2023

I tried to install @discordjs/opus using nodejs versions above v18.18.2 but the same error keeps coming back.
I have observed several identical cases using nodejs v20 and encountering this error. I have deduced that the package does not support versions higher than nodejs v18.18.2.
I have python 3.12 installed and visual studio installed.

Erreur :

C:\Users\mathi\Desktop\Spectra\botmusic> npm install @discordjs/opus@0.9.0
npm ERR! code 1
npm ERR! path C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus\prebuild\node-v115-napi-v3-win32-x64-unknown-unknown\opus.node --module_name=opus --module_path=C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus\prebuild\node-v115-napi-v3-win32-x64-unknown-unknown --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.4.5
npm ERR! node-pre-gyp info using node@20.8.0 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus\prebuild\node-v115-napi-v3-win32-x64-unknown-unknown\opus.node" (not found)
npm ERR! 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
npm ERR! 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
npm ERR! 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)
npm ERR! 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
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.8.0 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.8.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.0 found at "C:\Users\mathi\AppData\Local\Programs\Python\Python312\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2022 (17.7.34202.233) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS 
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:380:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2015 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:364:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:67:12
npm ERR! gyp ERR! stack     at VisualStudioFinder.parseData (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:237:5)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:143:14
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:414:7)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\mathi\\Desktop\\Spectra\\botmusic\\node_modules\\@discordjs\\opus\\prebuild\\node-v115-napi-v3-win32-x64-unknown-unknown\\opus.node" "--module_name=opus" "--module_path=C:\\Users\\mathi\\Desktop\\Spectra\\botmusic\\node_modules\\@discordjs\\opus\\prebuild\\node-v115-napi-v3-win32-x64-unknown-unknown" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus
npm ERR! gyp ERR! node -v v20.8.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus\prebuild\node-v115-napi-v3-win32-x64-unknown-unknown\opus.node --module_name=opus --module_path=C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus\prebuild\node-v115-napi-v3-win32-x64-unknown-unknown --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\node-pre-gyp\lib\util\compile.js:85:20)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19045
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mathi\\Desktop\\Spectra\\botmusic\\node_modules\\@discordjs\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\mathi\Desktop\Spectra\botmusic\node_modules\@discordjs\opus
npm ERR! node-pre-gyp ERR! node -v v20.8.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.4.5
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: C:\Users\mathi\AppData\Local\npm-cache\_logs\2023-10-24T17_18_34_549Z-debug-0.log
@Caredas Caredas added the bug Something isn't working label Oct 26, 2023
@Jiralite
Copy link
Member

Jiralite commented Oct 26, 2023

This package definitely does support that version and has for a long time now. I installed it successfully on Node.js 18.17.1 right now, just to be sure.

I'm not sure why this is failing for you though. Maybe look at where it says this:

could not find a version of Visual Studio 2017 or newer to use

npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows

Also, do you have build tools installed?

@Jiralite
Copy link
Member

I tried to install @discordjs/opus using nodejs versions above v18.18.2

Wait, is the title of your issue wrong?

@Caredas
Copy link
Author

Caredas commented Oct 26, 2023

Yes I have python 3.12 installed and visual studio installed as indicated in the error.
I've seen around me that several people had the same problem with a nodejs version higher than v18.

@Caredas Caredas changed the title @discordjs/opus does not support nodejs versions < v18.18.2 @discordjs/opus does not support nodejs versions > v18.18.2 Oct 26, 2023
@Jiralite
Copy link
Member

Hmm, I managed a successful install on 20.9.0. Maybe this is a Windows issue, as I'm reproducing this on Mac...

@Connor200024
Copy link

Connor200024 commented Nov 17, 2023

Do we have any idea on when this can be fixed? I am having issues installing this on my Ubuntu 22.04 LTS? any help would be fab?

We have managed to install v17.9.1 but would be good to see this on the current versions. :)

@CrisitoJ
Copy link

Same problem on arch and windows.

@emrislm
Copy link

emrislm commented Dec 16, 2023

Same issue. It won't install on Node v20.9.0 - Python 3.12.0 - windows-build-tools 5.2.2

@Hazmi35
Copy link

Hazmi35 commented Dec 20, 2023

There is indeed an issue with Python 3.12.

Python 3.12 removes "distutils" which breaks node-gyp before v10. node-gyp is located in npm's node_modules and you can't upgrade it without upgrading the whole npm.

Fortunately, node-gyp is updated on latest release of npm, which also preinstalled on Node.js v20.10.0. So to fix problems related to "distutils" and Python 3.12, you'll only need to upgrade your Node.js version. But, if you're using other package manager like pnpm, you'll need to wait for pnpm to upgrade their version of node-gyp.

Or you can replace the used node-gyp with your own installation of node-gyp.
You run this on bash or powershell in windows (replace / with \ on Windows):

npm i -g node-gyp
echo "node_gyp=$(npm config get prefix)/node_modules/node-gyp/bin/node-gyp.js)" >> ~/.npmrc

This will make the package manager calls your node-gyp installation instead of the bundled one from your package manager so you don't need to wait for pnpm to update

"But @discordjs/opus" use prebuilts, why it needs node-gyp?"
Well this package has prebuilt up to Node.js v19, not Node.js v20. When the prebuilt are not found it will build from source using node-gyp, and Node.js before v20.10.0 bundles npm that is older than npm v10.2.3 which includes the old node-gyp v9 which is incompatible with Python 3.12.

@emrislm
Copy link

emrislm commented Dec 20, 2023

Same issue. It won't install on Node v20.9.0 - Python 3.12.0 - windows-build-tools 5.2.2

I solved this just by switching to the latest v19 of Nodejs using nvm windows. Fortunately I did not have any v20 specific npm packages so it didn't break anything :)

@CatsMiaow
Copy link

The module is throwing a 404 error because the files associated with Node.js v20 (node-v115) have not yet been deployed.

https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v115-napi-v3-linux-x64-glibc-2.31.tar.gz

https://github.com/discordjs/opus/releases/tag/v0.9.0

npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | linux | x64
npm ERR! node-pre-gyp info check checked for "/home/discord/node_modules/@discordjs/opus/prebuild/node-v115-napi-v3-linux-x64-glibc-2.31/opus.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v115-napi-v3-linux-x64-glibc-2.31.tar.gz
npm ERR! 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-linux-x64-glibc-2.31.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @discordjs/[email protected] and [email protected] (node-v115 ABI, glibc) (falling back to source compile with node-gyp)
npm ERR! 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-linux-x64-glibc-2.31.tar.gz

@Rafat210907
Copy link

any one got the solution?

@CatsMiaow
Copy link

any one got the solution?

Until this is fixed, you can use the opusscript module instead.

@SkyLissh
Copy link

This issue is happening to me after I upgraded my Fedora wsl from 38 to 40, before it was working well. And the error appears no matter if I'm using node 20.13.1 or 19.9.0

With opusscript it's working without issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants