Skip to content

bun install/update behind proxy #17793

Description

@bmakan

What version of Bun is running?

1.2.4+fd9a5ea66

What platform is your computer?

Linux 5.15.0-124-generic x86_64 x86_64

What steps can reproduce the bug?

  1. set proxy: export http_proxy=<url>; export https_proxy=<url>
  2. run: bun install or bun update

What is the expected behavior?

Installation and/or update runs smoothly.

What do you see instead?

Randomly, the process just hangs at "Resolving..." or "Installing...". Once the cache is built in ~/.bun/install/cache, the process is fast and without any issues. But then bun update --latest may hang again due to downloading stuff.

This is especially problematic in a docker container. When I am trying to build an image with bun, the installation step always errors out with following error:

 => CANCELED [client 4/6] RUN bun install                                                                                     306.1s
------
 > [docs 4/6] RUN bun install:
2.822 bun install v1.2.4 (fd9a5ea6)
303.0 error: ShortRead decompressing "debug" to ".1e796befefe3ff75-00000442.debug"
303.0
303.0 error: InstallFailed extracting tarball from debug
303.0
303.0 error: ShortRead decompressing "algoliasearch" to ".bfec4dfdffac6ff5-00000443.algoliasearch"
303.0
303.0 error: InstallFailed extracting tarball from algoliasearch
303.0
303.0 error: ShortRead decompressing "image-size" to ".de2e4dddff37f67b-00000444.image-size"
303.0
303.0 error: InstallFailed extracting tarball from image-size
------
Dockerfile:33
--------------------
  31 |
  32 |     COPY docs/package.json docs/bun.lock ./
  33 | >>> RUN bun install
  34 |
  35 |     COPY docs .
--------------------
ERROR: failed to solve: process "/bin/sh -c bun install" did not complete successfully: exit code: 1
exit status 1
Image build failed!

My Dockerfile:

FROM oven/bun AS client

ARG proxy=<url>

ENV HTTP_PROXY=${proxy}
ENV HTTPS_PROXY=${proxy}

COPY client/package.json client/bun.lock ./
RUN bun install

COPY client .

RUN bun run build

When I run the exact same docker container interactively, I am able to install dependencies. But again, there's the occasional hanging which I need to kill (Ctrl + C) and run again.

I use the exact same proxy for npm, pip, apt, etc. These other tools don't have such problems.

Additional information

I have been struggling with these random "hangings" for months. I periodically check and install new bun versions, but the problem persists. Recently I attempted to replace my node-based docker build with bun to have the same build environment for production and development, which lead me to opening this issue.

Additional versions tested

🐛 : The bug is still present.

  • v1.2.5: 🐛
  • v1.2.6: 🐛
  • v1.2.7: 🐛
  • v1.2.8: 🐛
  • v1.2.9: 🐛
  • v1.2.10: 🐛
  • v1.2.11: 🐛
  • v1.2.12: 🐛
  • v1.2.13: 🐛

Activity

  1. bmakan commented on Mar 12, 2025

    @bmakan
    Author

    I've tried the latest oven/bun:1.2.5-alpine image and the issue persists.

  2. bmakan commented on Mar 26, 2025

    @bmakan
    Author

    The issue persists with bun v1.2.6. 🔥
    Although now it just hangs. I left it running while I took a bite, and came back to see it was stuck at bun install for over half an hour.

    I managed to build the image locally on Windows laptop in the WSL by removing the http_proxy variables. It's possible it went through some proxies at other levels of the network because I am still using company VPN.

  3. gnarroway-bullish commented on Mar 31, 2025

    @gnarroway-bullish

    Workaround is to do bun install || bun install || bun install || bun install || bun install

    • each invocation resolves part of the dependencies and then gets stuck, and waits for 5 minutes or so before failing
    • eventually all the dependencies are installed
    • once cached (in my case, in the CI system), subsequent jobs are faster

    This has the side effect of making bun the slowest package manager I've ever used (30 minutes to install a small project), but once it works, it works fast.

    Edit: This regression was introduced in 1.1.26 onwards

  4. added
    bun installSomething that relates to the npm-compatible client
    and removed on Mar 31, 2025
  5. danriedl commented on Aug 26, 2025

    @danriedl

    still does not work for me on 1.2.21

  6. bmakan commented on Aug 26, 2025

    @bmakan
    Author

    still does not work for me on 1.2.21

    While the proxy fix worked for me, there's still another issue related to cache. I always install/update dependencies with --no-cache otherwise it just gets stuck forever.

  7. tiann commented on Dec 4, 2025

    @tiann

    still does not work for me on 1.3.3, add --no-cache can fix the issue.

  8. snowfluke commented on Dec 23, 2025

    @snowfluke

    still does not work for me on 1.3.3, add --no-cache can fix the issue.

    @tiann thanks, it worked

  9. added a commit that references this issue on Mar 13, 2026
    ace03ea
  10. lushangkan commented on Mar 21, 2026

    @lushangkan

    still does not work for me on 1.3.3, add --no-cache can fix the issue.在 1.3.3 版本下我还是不行,添加 ——无缓存可以解决这个问题。

    It worked.

  11. added a commit that references this issue on Apr 25, 2026
    830133b
  12. added a commit that references this issue on May 14, 2026
    639f346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbun installSomething that relates to the npm-compatible client

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions