oven-sh / bun

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

Discord opus cannot find module #7730

Open MatthD opened 8 months ago

MatthD commented 8 months ago

What version of Bun is running?

1.0.18

What platform is your computer?

No response

What steps can reproduce the bug?

Hello !

I am having issue on my project after bun install (I added trustedDependencies inside package.json so that it run post install build node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-darwin-x64-unknown-unknown/opus.node)

But when running bun run --watch entrypoint.ts if failed trying to load

error: Cannot find module "/Users/dieudonn/Dev/backend/node/node_modules/@discordjs/opus/prebuild/node-v115-napi-v3-darwin-arm64-[object Promise]-[object Promise]/opus.node" from "/Users/dieudonn/Dev/backend/node/node_modules/@discordjs/opus/lib/index.js"

Info

I am on macOS 14.1.1 arm. (M2), I switched to x64 via arch -x86_64 zsh and then installed node-modules via bun. bun -v : 1.0.18

How to deal with this ? :slight_smile:

I also have another issue that is with bun install it seems to point to arch x64 but when running using arm

dlopen(/Users/dieudonn/Dev/backend/node/node_modules/bson-ext/build/Release/bson.node, 0x0001): tried: '/Users/dieudonn/Dev/backend/node/node_modules/bson-ext/build/Release/bson.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/dieudonn/Dev/backend/node/node_modules/bson-ext/build/Release/bson.node' (no such file), '/Users/dieudonn/Dev/backend/node/node_modules/bson-ext/build/Release/bson.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

So the problem can be resume as: bun install correctly for x64 via bun install but turn into arm via bun run

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Jarred-Sumner commented 8 months ago

error: Cannot find module "/Users/dieudonn/Dev/backend/node/node_modules/@discordjs/opus/prebuild/node-v115-napi-v3-darwin-arm64-[object Promise]-[object Promise]/opus.node" from "/Users/dieudonn/Dev/backend/node/node_modules/@discordjs/opus/lib/index.js"

[object Promise] is interesting, that seems likely the culprit

I also have another issue that is with bun install it seems to point to arch x64 but when running using arm

This is unlikely to ever work. Using Rosetta with Bun is not well supported - you can try it with the x64-baseline build, but it is not the default build