-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Failed to find package "@oven/bun-linux-x64"
error on npm i -g bun
docker step
#5545
Comments
Can confirm, same for 1.0.0 and 1.0.2 (tried both basing from |
I wonder if this is because alpine node does not install optional dependencies by default? (I don't know this to be true, but that's my guess) |
doesn't look like that, it fails even with explicit |
Seeing some strange behavior. Bun itself installs, the postinstall script failed. When I then manually run the postinstall script ( Upon digging further, on the alpine image the binary file shows up in the bin directory. When trying to run it I got: sh: ./bun: not found Eventually stumbled upon this StackExchange post with the reason behind the error. Turns out you need glibc to run Bun on Alpine. RUN apk --no-cache add ca-certificates wget
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk
RUN apk add --no-cache --force-overwrite glibc-2.28-r0.apk |
@squishyu oof, this works, but i'm not sure if it solves the issue. Sure, we can add this section to the docs (at least for now) and error message, but IMO solutions is not pretty and gonna divert some users from trying to use any images except for provided by bun |
@squishyu Can you provide a sample Dockerfile?
throws the following error:
|
@taranek Sorry, should've been more clear. Once you add the 4 An example Dockerfile: FROM node:18-alpine
# Add dependencies to get Bun working on Alpine
RUN apk --no-cache add ca-certificates wget
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk
RUN apk add --no-cache --force-overwrite glibc-2.28-r0.apk
# Install Bun
RUN npm install -g bun |
@squishyu Strange, it still doesn't work on my M1:
but if I use
|
This comment was marked as resolved.
This comment was marked as resolved.
@taranek Nevermind, my bad. The M1 Mac uses arm64 (or aarch64), therefore it needs different glibc binaries... FROM node:18-alpine
# Add dependencies to get Bun working on Alpine
RUN apk --no-cache add ca-certificates wget
RUN wget https://raw.githubusercontent.com/athalonis/docker-alpine-rpi-glibc-builder/master/glibc-2.26-r1.apk
RUN apk add --allow-untrusted --force-overwrite glibc-2.26-r1.apk
RUN rm glibc-2.26-r1.apk
# Install Bun
RUN npm install -g bun |
amazing, thank you. this works for me on Mac M1 Pro macOS Sonoma |
I can also confirm that it works. Thank you so much! |
Here's a simple combined version that checks CPU architecture and installs either the x86_64 or aarch64 version of glibc - so you can use the same Dockerfile on different machines. FROM node:18-alpine
# Add dependencies to get Bun working on Alpine
RUN apk --no-cache add ca-certificates wget
# Install glibc to run Bun
RUN if [[ $(uname -m) == "aarch64" ]] ; \
then \
# aarch64
wget https://raw.githubusercontent.com/squishyu/alpine-pkg-glibc-aarch64-bin/master/glibc-2.26-r1.apk ; \
apk add --no-cache --allow-untrusted --force-overwrite glibc-2.26-r1.apk ; \
rm glibc-2.26-r1.apk ; \
else \
# x86_64
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk ; \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub ; \
apk add --no-cache --force-overwrite glibc-2.28-r0.apk ; \
rm glibc-2.28-r0.apk ; \
fi
# Install Bun
RUN npm install -g bun |
I found this gist that mentions a better solution - instead of pulling in a whole new source (with a fixed version number at that), install the |
@Synchro > docker run --rm -it --entrypoint sh node:20-alpine
/ # apk add --no-cache gcompat
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
(1/3) Installing musl-obstack (1.2.3-r2)
(2/3) Installing libucontext (1.2-r2)
(3/3) Installing gcompat (1.1.0-r1)
OK: 10 MiB in 20 packages
/ # npm install -g bun --ignore-scripts
added 3 packages in 10s
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.1.0
npm notice Run npm install -g npm@10.1.0 to update!
npm notice
/ # cd /usr/local/lib/node_modules/bun/node_modules/@oven/bun-linux-x64-baseline/bin/
/usr/local/lib/node_modules/bun/node_modules/@oven/bun-linux-x64-baseline/bin # ./bun
Error relocating /usr/local/lib/node_modules/bun/node_modules/@oven/bun-linux-x64-baseline/bin/bun: unsupported relocation type 37
Error relocating /usr/local/lib/node_modules/bun/node_modules/@oven/bun-linux-x64-baseline/bin/bun: unsupported relocation type 37
Error relocating /usr/local/lib/node_modules/bun/node_modules/@oven/bun-linux-x64-baseline/bin/bun: unsupported relocation type 37 On arm64 it throws: /usr/local/lib/node_modules/bun/node_modules/@oven/bun-linux-aarch64/bin # ./bun
Segmentation fault (core dumped) Worth mentioning that while my solution isn't optimal, it only downloads a single package, installs it, then deletes the package file. |
It sounds like that's a problem in the package itself, rather than in the install process for it though? Was that reported to bun? |
@Synchro Answering your 2nd question: this whole thread is a bug report in Bun's repository ;) |
We just introduced a new Docker image: |
works on WSL |
Works great. Thank you |
my project works fine with |
please add support for |
This issue still persists. |
Got same error when use
|
Same here, I'm confused how to solve this? |
We use bun for some scripts. It should work inside |
In |
This problem still exists, on bun@1.1.13. |
|
Installing bun on alpine, be it from an official Adding So far, the only solution that works is #5545 (comment) I'm really looking forward for the |
What version of Bun is running?
1.0.1
What platform is your computer?
node:lts-alpine - docker image
What steps can reproduce the bug?
Dockerfile to reproduce the issue
npm install -g bun
fails with an error:What is the expected behavior?
bun package is installed successfully
What do you see instead?
Docker build step fails with an installation error
Additional information
No response
The text was updated successfully, but these errors were encountered: