mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
### What does this PR do? This PRs adjusts the "arch" string for Linux-musl variant to make sure it can be installed on ARM64 platforms using `npm`. Without this fix, installing bun on Alpine Linux on arm64 fails because the native binary cannot be found. #### Why it fails Bun attempts to find/download the native binaries during the postinstall phase (see [install.ts](https://github.com/oven-sh/bun/blob/bun-v1.1.42/packages/bun-release/src/npm/install.ts)). The platform matching logic lives in [platform.ts](https://github.com/oven-sh/bun/blob/bun-v1.1.42/packages/bun-release/src/platform.ts). Note how the "musl" variant is marked [as "aarch64"](https://github.com/oven-sh/bun/blob/bun-v1.1.42/packages/bun-release/src/platform.ts#L63-L69), while the regular "glibc" variant is marked [as "arm64"](https://github.com/oven-sh/bun/blob/bun-v1.1.42/packages/bun-release/src/platform.ts#L44-L49). On Alpine Linux distributions (or when using "node-alpine" docker image) we're supposed to be using the "musl" binary. However, since bun marks it as "aarch64" while the matching logic relies on `process.arch`, it never gets matched. Node.js uses "arm64", _not_ "aarch64" (see ["process.arch" docs](https://nodejs.org/docs/latest-v22.x/api/process.html#processarch)). In short - a mismatch between the expected arch ("aarch64") and the actual reported arch ("arm64") prevents bun from finding the right binary when installing with npm/pnpm. ### How did you verify your code works? Verified by running the installer on Alpine Linux on arm64. cc @magus
bun-release
Scripts that release Bun to npm, Dockerhub, Homebrew, etc.
Running
bun run npm # build assets for the latest release
bun run npm -- <release> # build assets for the provided release
bun run npm -- <release> [dry-run|publish] # build and publish assets to npm
Credits
- esbuild, for its npm scripts which this was largely based off of.