bun icon indicating copy to clipboard operation
bun copied to clipboard

bun install/create fails with error: ConnectionRefused downloading package manifest

Open PrajvalBadiger opened this issue 1 year ago • 27 comments

What version of Bun is running?

1.0.0+350403663e5ece8b1d09adce3a3594f8e05bf8f1

What platform is your computer?

Linux 6.5.2-zen1-1-zen x86_64 unknown

What steps can reproduce the bug?

  1. create a new directory and cd into it then run the below commands
  2. bun init
  3. bun install

or

$ bun create react my-app

What is the expected behavior?

Should install packages from package.jdon

What do you see instead?

$ bun install --verbose
bun install v1.0.0 (35040366)
Enqueue package manifest for download: bun-types
Enqueue package manifest for download: figlet
  🔍 bun-types [11/12]
error: ConnectionRefused downloading package manifest bun-types
  🔍 figlet [12/12]
error: ConnectionRefused downloading package manifest figlet


warn: warn: ConnectionRefused downloading package manifest bun-types


warn: warn: ConnectionRefused downloading package manifest figlet


warn: warn: ConnectionRefused downloading package manifest bun-types


warn: warn: ConnectionRefused downloading package manifest figlet


warn: warn: ConnectionRefused downloading package manifest bun-types


warn: warn: ConnectionRefused downloading package manifest figlet


warn: warn: ConnectionRefused downloading package manifest bun-types


warn: warn: ConnectionRefused downloading package manifest figlet


warn: warn: ConnectionRefused downloading package manifest bun-types


warn: warn: ConnectionRefused downloading package manifest figlet

error: bun-types@latest failed to resolve
error: figlet@^1.6.0 failed to resolve

Additional information

$ cat package.json
{
    "name": "bun-quick-start",
    "module": "index.ts",
    "type": "module",
    "scripts": {
        "start": "bun run index.ts"
    },
    "devDependencies": {
        "bun-types": "latest"
    },
    "peerDependencies": {
        "typescript": "^5.0.0"
    },
    "dependencies": {
        "figlet": "^1.6.0"
    }
}

PrajvalBadiger avatar Sep 11 '23 18:09 PrajvalBadiger

I'm having the same issue with

> bun --version
1.0.1
> time bun install
bun install v1.0.1 (31aec4eb)
  🔍 bun-types [6/6] 
error: ConnectionRefused downloading package manifest bun-types
error: bun-types@latest failed to resolve

________________________________________________________
Executed in  450.16 secs      fish           external
   usr time   23.79 millis    6.70 millis   17.09 millis
   sys time   34.56 millis    2.89 millis   31.67 millis

it took more than 7 minutes to get to this error

I'm running it on a M1 mac:

12.5 (21G72)

I assume this is caused by ipv6.

nicu-chiciuc avatar Sep 13 '23 13:09 nicu-chiciuc

For me it immediately trows this error. I have a working Internet connection. I also upgraded to v1.0.1 and still the same issue

$ bun upgrade
bun v1.0.1 is out! You're on 1.0.0
[20.71s] Upgraded.

Welcome to bun v1.0.1!

Report any bugs:

    https://github.com/oven-sh/bun/issues

What's new:

    https://github.com/oven-sh/bun/releases/tag/bun-v1.0.1

Changelog:

    https://github.com/oven-sh/bun/compare/bun-v1.0.0...bun-v1.0.1
$ time bun install
bun install v1.0.1 (31aec4eb)
  🔍 bun-types [11/12]
error: ConnectionRefused downloading package manifest bun-types
  🔍 figlet [12/12]
error: ConnectionRefused downloading package manifest figlet
error: bun-types@latest failed to resolve
error: figlet@^1.6.0 failed to resolve
bun install  0.02s user 0.02s system 38% cpu 0.100 total

PrajvalBadiger avatar Sep 13 '23 14:09 PrajvalBadiger

Having this problem in an M1 mac using 1.0.1 too, but it does work if I set IPv6 to link-local only.

abdielbrilhante avatar Sep 13 '23 14:09 abdielbrilhante

I am not sure how to configure IPv6 to link-local only on linux. For me it works when i disable IPv6 in kernel cmdline parameters

ipv6.disable=1

PrajvalBadiger avatar Sep 13 '23 15:09 PrajvalBadiger

same problem with 1.0.2

jjhesk avatar Sep 20 '23 18:09 jjhesk

I got this when I ran time bun install

`bun install v1.0.3 (25e69c71) 🔍 bun-types [6/6] error: FailedToOpenSocket downloading package manifest bun-types error: bun-types@latest failed to resolve

real 1m5.533s user 0m0.013s sys 0m0.005s`

shamiulalamupom avatar Sep 23 '23 04:09 shamiulalamupom

Fixed by this:

https://wiki.archlinux.org/title/IPv6#Disable_IPv6

# /etc/sysctl.d/40-ipv6.conf

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1

Then run sudo systemctl restart systemd-sysctl.service

acro5piano avatar Sep 24 '23 17:09 acro5piano

Can confirm this is still an issue for bun 1.0.4, I was able to work around on macos by setting IVP6 to "Link-local Only" in system settings. Including screenshot here in case it saves someone else a bit of time

Screenshot 2023-10-08 at 9 37 37 AM

Original error

What version of Bun is running?

$ bun --revision
1.0.4+745b6b94ee56cad24d475799690cc9a89957d15b

What platform is your computer?

Darwin mbp-16.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64 i386

What steps can reproduce the bug?

$ bun create elysia hi-elysia

What do you see instead?

error: ConnectionRefused

----- bun meta -----
Bun v1.0.4 (745b6b94) macOS x64 22.6.0
CreateCommand:
Elapsed: 75020ms | User: 20ms | Sys: 6ms
RSS: 6.80MB | Peak: 6.80MB | Commit: 34.61MB | Faults: 0
----- bun meta -----

0   0x103a9d8d0 WTFGetBacktrace

Crash report saved to:
  ~/.bun/.bun-crash/v1.0.4-1696777966674.crash

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

christiannaths avatar Oct 08 '23 15:10 christiannaths

So yes, disabling or preferring IPv4 is the correct solution. Here's the process for WSL:

Open this /etc/gai.conf config file using this command: sudo vi /etc/gai.conf

Either add or uncomment this line precedence ::ffff:0:0/96 100, uncommenting is removing the # sign.

Tap Esc key and then type :w to save file. Close and reopen terminal, bun install should install now.

N.B.: This will PREFER IPv4 not necessarily turn IPv6 off.

Kitanga avatar Oct 09 '23 04:10 Kitanga

Can confirm this is an issue on bun 1.0.21. Disabling IPv6 solved the issue. (On Debian 11)

godismyjudge95 avatar Jan 02 '24 18:01 godismyjudge95

might be related. I get this while trying to bun install or bun add anything on an old intel mac (it's so old the latest OS available for it is Big Sur)

The error is slightly different to above failed to initialize compression stream downloading package manifest

I tried disabling IPv6 as best I could but wasn't able to move forward

Screen Shot 2024-01-03 at 1 29 51 PM

YoavCodes avatar Jan 03 '24 19:01 YoavCodes

I'm also getting the same error on an old intel mac bun 1.0.21

failed to initialize compression stream downloading package manifest

I set ipv6 to link-local only, but that didn't work.

rinvii avatar Jan 04 '24 05:01 rinvii

Hi,

Same here on a Macbook pro Mid 2014 (Intel) and MacOS Big Sur 11.7.10.

This is specific to Bun v1.0.21, it works well on v1.0.20:

bun add v1.0.21 (837cbd60)
  🔍 cowsay [6/6] 
error: failed to initialize compression stream downloading package manifest cowsay
error: cowsay@ failed to resolve

cd ..
rm -rf .bun 
curl -fsSL https://bun.sh/install | bash -s "bun-v1.0.20"
######################################################################## 100.0%
bun was installed successfully to ~/.bun/bin/bun 
Run 'bun --help' to get started
cd quickstart 
bun install cowsay
bun add v1.0.20 (09d51486)

 + @types/[email protected]

 installed [email protected] with binaries:
  - cowsay
  - cowthink

 36 packages installed [1.52s]

baptistecs avatar Jan 04 '24 08:01 baptistecs

Other thread on the same issue there: https://discord.com/channels/876711213126520882/1192197434827345930/1192233818220924948

@Jarred-Sumner

baptistecs avatar Jan 04 '24 08:01 baptistecs

yes, it's the IPV6 problem.

guotie avatar Jan 05 '24 13:01 guotie

Hi,

Same here on a Macbook pro Mid 2014 (Intel) and MacOS Big Sur 11.7.10.

This is specific to Bun v1.0.21, it works well on v1.0.20:

bun add v1.0.21 (837cbd60)
  🔍 cowsay [6/6] 
error: failed to initialize compression stream downloading package manifest cowsay
error: cowsay@ failed to resolve

cd ..
rm -rf .bun 
curl -fsSL https://bun.sh/install | bash -s "bun-v1.0.20"
######################################################################## 100.0%
bun was installed successfully to ~/.bun/bin/bun 
Run 'bun --help' to get started
cd quickstart 
bun install cowsay
bun add v1.0.20 (09d51486)

 + @types/[email protected]

 installed [email protected] with binaries:
  - cowsay
  - cowthink

 36 packages installed [1.52s]

Same "failed to initialize compression stream downloading package manifest xxx" error on macbook intel Big Sur. Wifi with Configure IPv6 set to Link-Local only Thank you for the tips of going back to 1.0.20

No issue on MacBook arm Sonoma

WeetA34 avatar Jan 06 '24 14:01 WeetA34

Is there any way to solve it? I also encountered such a problem

yangfan-coder avatar Jan 09 '24 11:01 yangfan-coder

Check my link on Discord, you can set an environment variable in front of “bun install”

On Tue, Jan 9, 2024 at 12:59 杨老汉儿 @.***> wrote:

Is there any way to solve it? I also encountered such a problem

— Reply to this email directly, view it on GitHub https://github.com/oven-sh/bun/issues/4988#issuecomment-1882941660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AME24I4THPRJ66DRNHRNJY3YNUWIPAVCNFSM6AAAAAA4TYRD46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSHE2DCNRWGA . You are receiving this because you commented.Message ID: @.***>

baptistecs avatar Jan 09 '24 12:01 baptistecs

BUN_DISABLE_COMPRESSION_FRAMEWORK=1 bun install

On Tue, Jan 9, 2024 at 13:13 Baptiste Clarey Sjöstrand < @.***> wrote:

Check my link on Discord, you can set an environment variable in front of “bun install”

On Tue, Jan 9, 2024 at 12:59 杨老汉儿 @.***> wrote:

Is there any way to solve it? I also encountered such a problem

— Reply to this email directly, view it on GitHub https://github.com/oven-sh/bun/issues/4988#issuecomment-1882941660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AME24I4THPRJ66DRNHRNJY3YNUWIPAVCNFSM6AAAAAA4TYRD46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSHE2DCNRWGA . You are receiving this because you commented.Message ID: @.***>

baptistecs avatar Jan 09 '24 12:01 baptistecs

disabling ipv6 is not a solution.

terminaldweller avatar Mar 05 '24 15:03 terminaldweller

Any update on this? Issue still persists with v1.1.0 even when IPV6 disabled or env var passed.

I am on macOS 14.3 M1 Max.

escwxyz avatar Apr 04 '24 02:04 escwxyz

I encountered the issue while trying to download the package manifest for the create-astro package in Bun and Astro. The error message error: ConnectionRefused downloading package manifest create-astro followed by error: create-astro@latest failed to resolve is displayed when attempting to create a new Astro project using the command bun create-astro@latest app --yes.

Additionally, I faced a similar problem when trying to create a React app using the command bun create react my-app and create astro@latest -- --template framework-react. However, the bun init command runs without any issues.

I performed these attempts within a Docker environment using the following Dockerfile and Docker Compose configuration:

Dockerfile:

FROM oven/bun:latest
WORKDIR /app
RUN bunx create-astro@latest app --yes
USER bun
EXPOSE 4321/tcp
ENTRYPOINT ["tail", "-f", "/dev/null"]

Docker Compose:

version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "4321:4321"
    volumes:
      - ./app:/app

It seems that the issue arises specifically when trying to download the package manifest and resolve dependencies within the Docker environment. The create-astro and React app creation commands fail to resolve dependencies properly, resulting in the mentioned errors.

I would appreciate any guidance or assistance in resolving this issue to successfully create Astro and React projects within the Docker environment using Bun.

JhonierNegrete10 avatar Apr 08 '24 06:04 JhonierNegrete10

I am using a proxy on MacOS.

The origin config is:

export HTTP_PROXY=http://localhost:7890
export http_proxy=http://localhost:7890
export HTTPS_PROXY=http://localhost:7890
export https_proxy=http://localhost:7890

Another tools works well but Bun does not. I change the localhost to 127.0.0.1 and now it works.

PeterlitsZo avatar Apr 08 '24 15:04 PeterlitsZo

Looking for a solution for this as well

riezahughes avatar Apr 15 '24 15:04 riezahughes

It worked for me when I disabled the global cache. (It might be that I have invalid entries in my global cache?) I added this to mu bunfig.toml file:

[install.cache]
# when true, don't load from the global cache.
# Bun may still write to node_modules/.cache
disable = true

# when true, always resolve the latest versions from the registry
disableManifest = false

https://bun.sh/docs/install/cache

ricsam avatar Apr 22 '24 16:04 ricsam

I'm getting this issue, too. Never encountered a package manager where downloading is such a problem...

kevin-lindsay-1 avatar May 15 '24 14:05 kevin-lindsay-1

Can confirm this is still an issue for bun 1.0.4, I was able to work around on macos by setting IVP6 to "Link-local Only" in system settings. Including screenshot here in case it saves someone else a bit of time

Screenshot 2023-10-08 at 9 37 37 AM **Original error**

What version of Bun is running?

$ bun --revision
1.0.4+745b6b94ee56cad24d475799690cc9a89957d15b

What platform is your computer?

Darwin mbp-16.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64 i386

What steps can reproduce the bug?

$ bun create elysia hi-elysia

What do you see instead?

error: ConnectionRefused

----- bun meta -----
Bun v1.0.4 (745b6b94) macOS x64 22.6.0
CreateCommand:
Elapsed: 75020ms | User: 20ms | Sys: 6ms
RSS: 6.80MB | Peak: 6.80MB | Commit: 34.61MB | Faults: 0
----- bun meta -----

0   0x103a9d8d0 WTFGetBacktrace

Crash report saved to:
  ~/.bun/.bun-crash/v1.0.4-1696777966674.crash

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

I'm getting this issue, too. Above workaround worked for me.

OmkarKirpan avatar May 18 '24 10:05 OmkarKirpan

I got this issue in this couple of days when I use bunx command

ryoppippi avatar Jul 24 '24 13:07 ryoppippi

Turning wifi off and on fixed the problem for me, average engineer solution

moloxe avatar Jul 28 '24 19:07 moloxe