oven-sh / bun

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

bun install `resolve` step *extremely* slow #4938

Open enapupe opened 1 year ago

enapupe commented 1 year ago

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Darwin 21.6.0 x86_64 i386

What steps can reproduce the bug?

run any sort of install command, the initial resolve dependency graph step takes forever - I have one run still running and will follow up if it ever finishes.

running bun install with --verbose doesn't help

is there any other flags/envs I could add to make it even more verbose and help debug this?

I guess this is network intensive operation, ~doing a similar command using yarn/npm works fast~. I have Starlink and my connection is currently healthy (up to 20mb/s download speed).

What is the expected behavior?

bun install should be fast and not just hang

What do you see instead?

bun install --verbose bun install v1.0.0 (822a00c4) Enqueue package manifest for download: @jridgewell/gen-mapping Enqueue package manifest for download: @pollyjs/adapter-node-http Enqueue package manifest for download: @pollyjs/core Enqueue package manifest for download: @pollyjs/persister-fs Enqueue package manifest for download: @types/aws-lambda Enqueue package manifest for download: @types/factory-girl Enqueue package manifest for download: @types/jest Enqueue package manifest for download: @types/node Enqueue package manifest for download: @types/pg Enqueue package manifest for download: @types/pollyjs__core Enqueue package manifest for download: @types/redis Enqueue package manifest for download: @types/request Enqueue package manifest for download: @types/sanitize-html Enqueue package manifest for download: acorn-loose Enqueue package manifest for download: acorn-walk Enqueue package manifest for download: axios-mock-adapter Enqueue package manifest for download: commitizen Enqueue package manifest for download: conventional-changelog-cli Enqueue package manifest for download: cz-conventional-changelog Enqueue package manifest for download: factory-girl Enqueue package manifest for download: husky Enqueue package manifest for download: jest Enqueue package manifest for download: jest-junit Enqueue package manifest for download: prettier Enqueue package manifest for download: resolve Enqueue package manifest for download: serverless Enqueue package manifest for download: serverless-iam-roles-per-function Enqueue package manifest for download: serverless-layers Enqueue package manifest for download: serverless-offline Enqueue package manifest for download: serverless-plugin-epsagon Enqueue package manifest for download: setup-polly-jest Enqueue package manifest for download: timekeeper Enqueue package manifest for download: ts-jest Enqueue package manifest for download: ts-node Enqueue package manifest for download: tslint Enqueue package manifest for download: tslint-config-prettier Enqueue package manifest for download: tslint-consistent-codestyle Enqueue package manifest for download: tslint-plugin-prettier Enqueue package manifest for download: typescript Enqueue package manifest for download: @sentry/serverless Enqueue package manifest for download: aws-sdk Enqueue package manifest for download: axios Enqueue package manifest for download: epsagon Enqueue package manifest for download: franc-min Enqueue package manifest for download: joi Enqueue package manifest for download: knex Enqueue package manifest for download: moment Enqueue package manifest for download: objection Enqueue package manifest for download: objection-db-errors Enqueue package manifest for download: pg Enqueue package manifest for download: redis Enqueue package manifest for download: sanitize-html Enqueue package manifest for download: sharp 🔍 Resolving [1/53] 🔍 @types/aws-lambda [111/163]

Additional information

No response

enapupe commented 1 year ago

Nevermind, it seems my computer was using IPv6 and this was causing issues, no idea why though. I've disabled IPv6 and it's freaking fast now.

nicu-chiciuc commented 1 year ago

@enapupe I think I have the same issue, could you give more explanation about which system you're using and how you "disabled ipv6"? I remember having the same issue with Node, and fixed that with:

# https://github.com/nodejs/node/issues/41145#issuecomment-992948130
set --global --export NODE_OPTIONS --dns-result-order=ipv4first
enapupe commented 1 year ago

@nicu-chiciuc I'm using macOS and "disabled" IPv6 on my WiFi settings.

Electroid commented 1 year ago

Regardless, we should fix the issue if it's slow on IPv6.

enapupe commented 1 year ago

Cool, actually I closed the issue before because I noticed it was also slow for yarn and npm, so it didn't really seem like a problem with Bun itself.

nicu-chiciuc commented 1 year ago

ah, I got to the Network > TCP/IP in Preferences, but wasn't sure if "Link-local only" was the option to disable ipv6.

@Electroid until/whether it's fixed, it would be really helpful to have this fix/issue mentioned in the README.md

hackrmomo commented 1 year ago

I'm having the same issue. I am running RHEL however, not macOS. my macOS install of bun worked flawlessly. Disabling IPV6 using

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1 

also did the trick for me.

hchangjae commented 7 months ago

sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1

This works for me!

Scc33 commented 7 months ago

I'm having the same issue. I am running RHEL however, not macOS. my macOS install of bun worked flawlessly. Disabling IPV6 using

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1 

also did the trick for me.

If macOS install didn't work try a restart. That fixed my Mac slowness.

janek commented 4 months ago

on macOS, I went to Settings -> TCP/IP, chose Link local only as mentioned above, switched wifi off and on and it worked

hashcovet commented 1 month ago

I'm having the same issue. I am running RHEL however, not macOS. my macOS install of bun worked flawlessly. Disabling IPV6 using

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1 

also did the trick for me.

Worked for me