oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.42k stars 2.78k forks source link

The postinstall script of the @discordjs/opus package crashes during installation. #12554

Open titsex opened 4 months ago

titsex commented 4 months ago

What version of Bun is running?

1.1.20

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

bun add @discordjs/opus

or

bun add @discordjs/opus --trust

What is the expected behavior?

image

What do you see instead?

bun install v1.1.20 (ae194892)
  ⚙️  @discordjs/opus [1/1] node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.4.5
node-pre-gyp info using node@21.7.3 | win32 | x64
(node:11736) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node-pre-gyp info check checked for "C:\Users\arava\Documents\Projects\discord-bot\node_modules\@discordjs\opus\prebuild\node-v120-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-v120-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-v120-napi-v3-win32-x64-unknown-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for @discordjs/opus@0.9.0 and node@21.7.3 (node-v120 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-v120-napi-v3-win32-x64-unknown-unknown.tar.gz
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack Error: spawn EINVAL
node-pre-gyp ERR! stack     at ChildProcess.spawn (node:internal/child_process:421:11)
node-pre-gyp ERR! stack     at Object.spawn (node:child_process:761:9)
node-pre-gyp ERR! stack     at module.exports.run_gyp (C:\Users\arava\Documents\Projects\discord-bot\node_modules\@discordjs\node-pre-gyp\lib\util\compile.js:72:17) 
node-pre-gyp ERR! stack     at build (C:\Users\arava\Documents\Projects\discord-bot\node_modules\@discordjs\node-pre-gyp\lib\build.js:36:11)
node-pre-gyp ERR! stack     at self.commands.<computed> [as build] (C:\Users\arava\Documents\Projects\discord-bot\node_modules\@discordjs\node-pre-gyp\lib\node-pre-gyp.js:72:34)
node-pre-gyp ERR! stack     at run (C:\Users\arava\Documents\Projects\discord-bot\node_modules\@discordjs\node-pre-gyp\lib\main.js:90:29)
node-pre-gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
node-pre-gyp ERR! System Windows_NT 10.0.22631
node-pre-gyp ERR! command "C:\\Users\\arava\\AppData\\Local\\Volta\\tools\\image\\node\\21.7.3\\node.exe" "C:\\Users\\arava\\Documents\\Projects\\discord-bot\\node_modules\\@discordjs\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\arava\Documents\Projects\discord-bot\node_modules\@discordjs\opus
node-pre-gyp ERR! node -v v21.7.3
node-pre-gyp ERR! node-pre-gyp -v v0.4.5

Additional information

I tried adding @discordjs/opus to the list of trusted packages - the problem is the same (https://bun.sh/guides/install/trusted)

Also, if you install this package via npm, yarn or pnpm, postinstall is successful.

titsex commented 4 months ago

A few more details.

Download link @discordjs/opus from the ban error: https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v120-napi-v3-win32-x64-unknown-unknown.tar.gz

Download link from the @discordjs/opus repository, from the latest release: https://github.com/discordjs/opus/releases/download/v0.9.0/opus-v0.9.0-node-v102-napi-v3-win32-x64-unknown-unknown.tar.gz

As we can see, for some reason the ban was confused trying to download v120 instead of v102.

Moreover, v120 is not even in the releases)

RuiNtD commented 2 months ago

A similar issue occurs with @sapphire/type:

error: Cannot find module "Z:\bun-type-test\node_modules\@sapphire\type\prebuild\type-node-v127-win32-x64-unknown-unknown\type.node" from "Z:\bun-type-test\node_modules\@sapphire\type\dist\esm\index.mjs"

Where only a type-node-v115-win32-x64-unknown-unknown exists.