oven-sh / bun

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

bun install takes extremely long time #4066

Closed alyiev closed 1 week ago

alyiev commented 1 year ago

What platform is your computer?

Darwin 22.6.0 arm64 arm

How did you attempt to install or upgrade?

bun install

What do you see instead?

bun install bun install v0.7.3 (a9b3d583)

Additional information

Trying to install those packages:

"dependencies": {
    "@expo-google-fonts/andika": "^0.2.3",
    "@expo/vector-icons": "^13.0.0",
    "@reduxjs/toolkit": "^1.9.5",
    "@tamagui/animations-moti": "^1.43.16",
    "@tamagui/animations-react-native": "^1.43.16",
    "@tamagui/config": "^1.43.16",
    "@tamagui/shorthands": "^1.43.16",
    "@tamagui/themes": "^1.43.16",
    "expo": "^49.0.6",
    "expo-constants": "~14.4.2",
    "expo-font": "~11.4.0",
    "expo-linking": "~5.0.2",
    "expo-location": "~16.1.0",
    "expo-random": "^13.1.1",
    "expo-router": "2.0.0",
    "expo-splash-screen": "~0.20.4",
    "expo-status-bar": "~1.6.0",
    "immer": "^10.0.2",
    "lodash-es": "^4.17.21",
    "ramda": "^0.28.0",
    "react": "18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "0.72.3",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-maps": "1.7.1",
    "react-native-mmkv": "^2.10.1",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-web": "~0.19.6",
    "react-redux": "^8.1.1",
    "redux-persist": "^6.0.0",
    "tamagui": "^1.43.16",
    "zustand": "^4.3.6"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@tamagui/babel-plugin": "^1.43.16",
    "@types/lodash-es": "^4.17.7",
    "@types/ramda": "^0.28.23",
    "@types/react": "~18.2.14",
    "@types/uuid": "^9.0.1",
    "babel-plugin-transform-inline-environment-variables": "^0.4.4",
    "eslint": "^8.45.0",
    "eslint-config-airbnb-typescript-prettier": "^5.0.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-import": "^2.28.0",
    "eslint-plugin-prettier": "5.0.0",
    "expo-dev-client": "^2.4.6",
    "prettier": "^3.0.0",
    "react-devtools": "^4.27.2",
    "typescript": "^5.1.3"
  },
Jarred-Sumner commented 1 year ago

wow 2400 seconds is insane

choopk commented 1 year ago

same installing packages from a private repo took forever and failed, the installation was never complete for me after waiting for 2 hours

Jarred-Sumner commented 1 year ago

This is likely a bug with our dns code

I'm sorry you waited two hours

choopk commented 1 year ago

its a clean install. it queues up all the package and takes forever to process. But yarn install takes a min to complete image

bun version used is 1.0.0

omega1996 commented 1 year ago

same problem with docker and bun 1.0.2 image

Brandoko commented 1 year ago

Also had this issue on bun 1.0.0. Took 76.18s to install async-retry on MacOS 13.6.

bun add -d @types/async-retry

Screenshot 2023-09-23 at 12 23 02 PM
Jarred-Sumner commented 1 year ago

Please leave a comment if you continue to run into this after bun upgrade --canary

choopk commented 1 year ago

still slow after bun upgrade --canary image

Jarred-Sumner commented 1 year ago

@choopk how long does it take with Yarn or npm or pnpm? If you pass bun install --no-cache does it get faster?

choopk commented 1 year ago

with yarn clean install is about 49 sec. image bun install --no-cache didnt help

Jarred-Sumner commented 1 year ago

@choopk if you do rm -rf ~/.bun/install node_modules bun.lockb in your project, does that help?

choopk commented 1 year ago

sadly no.

Jarred-Sumner commented 1 year ago

Please leave a comment if you still run into it

KnockOutEZ commented 1 year ago

Still running into it. For some reason it works really fast when I deploy it in Render But in local machine its taking eternity image

Ychop commented 1 year ago

Same here with bun 1.0.6, is there any update for this?

sobhanessi commented 1 year ago

I can also confirm that I have the same issue by running bun create next-app and it never ended! not sure whether it is from host or the bun's bug but I hope it gets fixed as soon as possible since we want to contribute to this project. thanks.

sobhanessi commented 1 year ago

alright one update, I tried with bunx create-next-app it worked and it was usual but not faster than yarn! but I can confirm that bun update also is very slow in nextjs application to update packages. it's been running for more than an hour at the time of writing. hope to get fixed as soon as possible.

rafaellehmkuhl commented 1 year ago

Can confirm the same behavior here on 1.0.2. Upgraded to 1.0.7 but the issue persists. The internet connection here is fine and yarn took less than a minute to install all.

image

rafaellehmkuhl commented 1 year ago

Update on this: changing my DNS to 8.8.8.8 (Google) solved the problem.

Ychop commented 1 year ago

Restarting my docker daemon did i it for me...

sobhanessi commented 1 year ago

Ok, I believe it's the problem of BUN's servers which are currently workung ok.

lukevinicius commented 10 months ago

Same here with bun 1.0.16

Screenshot 2023-12-13 at 10 53 36

m1212e commented 10 months ago

For me, changing my DNS server actually resolved the problem!

swarajbachu commented 9 months ago

cool changing dns worked for me too, if you are using warp or some vpn and change it to normal wife network its working

evayde commented 9 months ago

I had the same issue and changing DNS did not work. However, after restarting my mac it worked.

I am on Ventura.

jfarcas commented 9 months ago

I had the same issue and changing DNS did not work. This solution work for me. https://github.com/oven-sh/bun/issues/4938#issuecomment-1720172113 I'm on Ubuntu

rizkyilhampra commented 9 months ago

I had the same issue when I first installed bun 1.0.25. I just saw the text "resolving" for about a minute until I killed it. Reconnecting my network fixed it.

cisaacstern commented 9 months ago

Adding that I also hit a very slow build with bun 1.0.25. As suggested above, bun install --upgrade canary resolved this for me.

datsfilipe commented 9 months ago

I had the same issue and changing DNS did not work. This solution work for me. #4938 (comment) I'm on Ubuntu

Disabling ipv6 here on NixOS worked for me too.

ImTheDeveloper commented 8 months ago

Adding that I also hit a very slow build with bun 1.0.25. As suggested above, bun install --upgrade canary resolved this for me.

Just hit this very issue on docker build also. Canary indeed was the fix for me too.

LiamWiddop commented 8 months ago

Having this issue again on Bun version 1.0.27 - Nil improvement with bun install --upgrade canary, changing DNS on /etc/netplan/01-network-manager-all.yaml to [8.8.8.8, 8.8.4.4], nor disabling ipv6 per https://github.com/oven-sh/bun/issues/4938#issuecomment-1720172113 . Nil improvement with reconnecting to my network either. Running on Ubuntu.

0xMySt1c commented 8 months ago

still running into issues with bun install --upgrade canary when using ubuntu-latest in CI. One thing of note, the self-hosted action runner is running in a docker container on a mac m1 wired over a privacy VPN.

smashah commented 7 months ago

This makes docker builds seize up in CI/CD what is going on here?

jtrv commented 7 months ago

The bug for me seemed to be related to IPV6, this temporary workaround worked for me on Arch:

uncomment precedence ::ffff:0:0/96 100 in /etc/gai.conf

Although ideally this bug should get triaged soon. There may be many users experiencing this without reporting.

ref: https://github.com/oven-sh/bun/issues/4988#issuecomment-1752328956

smashah commented 7 months ago

I was able to get consistent builds by turning off postinstall scripts in my dockerfile.

If you turn on verbose mode you might see that the build usually times out or gets stuck on a script

RUN bun install --ignore-scripts --production
stabildev commented 7 months ago

+1 bun i is really slow and often stuck on resolving for minutes

Installing zod, taking 5 mins so far

image

Edit: Can confirm that restarting my mac fixed it...

rotimi-ajayi commented 7 months ago

Just installed bun 1.0.35 on my WSL 2, tried creating a Next App with bunx create-next-app@latest . and it is taking over 2.5 hours and still not done, as I'm currently typing. Showed that it is installing over a thousand packages/dependencies/things. I mean how is that even possible? bun-bug

eduardvercaemer commented 7 months ago

This happened to me, always blamed it on my network. Turns out 8.8.8.8 /did/ help solve it.

Using 1.1.1.1 it was just never getting through the resolve step. With 8.8.8.8 I could install >1000 packages (thanks javascript) in some seconds.

Jarred-Sumner commented 7 months ago

This is a bug that has had many causes

I think the remaining cause is our lack of IPv6 happy eyeballs support. Some domains only support IPv6 or only support IPv4. When getaddrinfo gets this wrong, then it means connections to those domains timeout, causing bun install to take a very long time to install. Since bun install internally uses the same HTTP client as bun's runtime, this issue also impacts fetch

Scc33 commented 7 months ago

Just tested Bun v1.1 on MacOS Sonoma. Initially I saw the bun install hang but it resolved itself after a restart.

Jarred-Sumner commented 7 months ago

In https://github.com/oven-sh/bun/pull/10037, I fixed a deadlock that could in theory occur if many packages took awhile to download, and then all of them finished extracting at once at just the right time before the main thread goes to sleep.

This wouldn't help if the cause is IPv6 (happy eyeballs), but if it was due to this deadlock it would fix it.

So please leave a comment if you continue to run into this after Bun v1.1.3

efstathiosntonas commented 6 months ago

@Jarred-Sumner using bun 1.1.4 on a Dockerfile still takes forever to install and it's stuck here: (tasks were 3 before i take the screenshot)

Screenshot 2024-04-17 at 11 27 22

FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile

# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

if I change this line: RUN cd /temp/dev && bun install --frozen-lockfile to RUN cd /temp/dev && bun install --frozen-lockfile --production install time drops back to normal.

edit: my dev deps:

Click me ``` "devDependencies": { "@commitlint/cli": "19.2.2", "@commitlint/config-conventional": "19.2.2", "@ianvs/prettier-plugin-sort-imports": "4.2.1", "@types/bun": "latest", "@types/geojson": "7946.0.14", "@types/lodash": "latest", "@types/pg": "8.11.5", "@typescript-eslint/eslint-plugin": "7.7.0", "@typescript-eslint/parser": "7.7.0", "auto-changelog": "2.4.0", "cspell": "8.7.0", "drizzle-kit": "0.20.14", "eslint": "8.57.0", "lefthook": "1.6.10", "madge": "7.0.0", "oxlint": "0.2.17", "prettier": "3.2.5", "release-it": "17.2.0", "ts-node": "10.9.2", "tsconfig-paths": "4.2.0" } ```
0tii commented 6 months ago

Still regularly encountering exceptionally slow installs in docker container. Almost always the install runs for pretty exactly 300 seconds plus a few. To me this looks like a 5 minute timeout that it reliably runs into.

Just did a fresh build

[+] Building 311.1s (9/9) FINISHED                                                                                                                                                                            docker:default
 => [app internal] load build definition from Dockerfile                                                                                                                                                                0.1s
 => => transferring dockerfile: 366B                                                                                                                                                                                    0.0s
 => [app internal] load metadata for docker.io/oven/bun:1.1.4                                                                                                                                                           1.7s
 => [app internal] load .dockerignore                                                                                                                                                                                   0.1s
 => => transferring context: 74B                                                                                                                                                                                        0.0s
 => [app base 1/3] FROM docker.io/oven/bun:1.1.4@sha256:ea572eace71acadb17ea5c408550eafd5ab82f2f6f48c04b906a3091e017cf35                                                                                                0.0s
 => [app internal] load build context                                                                                                                                                                                   0.1s
 => => transferring context: 323.06kB                                                                                                                                                                                   0.0s
 => CACHED [app base 2/3] WORKDIR /usr/src/app                                                                                                                                                                          0.0s
 => [app base 3/3] COPY package.json bun.lockb ./                                                                                                                                                                       0.2s
 => [app dev 1/1] RUN bun i --frozen-lockfile                                                                                                                                                                         305.4s
 => [app] exporting to image                                                                                                                                                                                            3.1s 
 => => exporting layers                                                                                                                                                                                                 3.0s 
 => => writing image sha256:121438b6f47052001fa692753430f3335057762e7b6deadc243cae13ff902157                                                                                                                            0.0s 
 => => naming to docker.io/library/cannahub-backend-app                                                                                                                                                                 0.0s 

using a plain dockerfile

FROM oven/bun:1.1.4 as base
WORKDIR /usr/src/app
COPY package.json bun.lockb ./

FROM base as dev
RUN bun i --frozen-lockfile

COPY . .
CMD ["bun", "start:dev"]

for CI/CD this is unbearable

Androz2091 commented 4 months ago

Hello, I'm experiencing the same thing (nuxt project)

FROM oven/bun:canary

WORKDIR /usr/src/app

COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile --production --no-cache

COPY . .

RUN bun test && bun run build || true

USER bun
EXPOSE 3000
CMD ["bun", "run", "server/index.mjs"]

Can someone reopen the issue please?

DajosPatryk commented 4 months ago

Encountered the same issue today on macOS Sonoma 14.5 and Docker Engine v26.1.1. Trying to dockerize a Nuxt3 project using a Dockerfile took over 20 minutes.

FROM oven/bun

WORKDIR /app

COPY package.json bun.lockb* ./

RUN bun install

COPY . .

RUN bun run build

EXPOSE 3000

CMD ["bun", "run", "dev"]

Adding the flag bun install --ignore-scripts made it work.

Firgrep commented 4 months ago

Also getting very long install times here. Not even a docker container.

See details for dependencies

```json "dependencies": { "@emotion/styled": "^11.11.0", "@google-cloud/storage": "^7.11.1", "@googlemaps/js-api-loader": "^1.16.6", "@mapbox/mapbox-gl-draw": "^1.4.3", "@mdxeditor/editor": "^3.4.0", "@mui/icons-material": "^5.15.13", "@mui/lab": "^5.0.0-alpha.168", "@mui/material": "^5.15.13", "@mui/x-data-grid-pro": "^6.19.6", "@mui/x-date-pickers-pro": "^7.2.0", "@next/third-parties": "^14.2.1", "@prisma/client": "^5.11.0", "@stripe/react-stripe-js": "^2.6.2", "@stripe/stripe-js": "^3.2.0", "@tanstack/react-query": "^5.28.0", "@types/dompurify": "^3.0.5", "@types/jsonwebtoken": "^9.0.6", "@types/react-map-gl": "^6.1.6", "dayjs": "^1.11.10", "dompurify": "^3.1.5", "jsonwebtoken": "^9.0.2", "mapbox-gl": "^3.2.0", "material-ui-popup-state": "^5.0.9", "mui-file-input": "^4.0.4", "mui-markdown": "^1.1.13", "next": "^14.1.3", "nextjs-cors": "^2.2.0", "prism-react-renderer": "^2.3.1", "prisma": "^5.11.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-map-gl": "^7.1.7", "react-material-ui-carousel": "^3.4.2", "react-plotly.js": "^2.6.0", "react-share": "^5.1.0", "react-tweet": "^3.2.1", "server-only": "^0.0.1", "stripe": "^15.1.0", "supertokens-node": "^16.7.4", "supertokens-web-js": "^0.8.0", "ts-node": "^10.9.2", "use-supercluster": "^1.2.0", "uuid": "^9.0.1", "worker-loader": "^3.0.8", "zod": "^3.22.4" }, "devDependencies": { "@storybook/addon-essentials": "^8.0.0", "@storybook/addon-interactions": "^8.0.0", "@storybook/addon-links": "^8.0.0", "@storybook/addon-themes": "^8.0.0", "@storybook/blocks": "^8.0.0", "@storybook/nextjs": "^8.0.0", "@storybook/react": "^8.0.0", "@storybook/testing-library": "^0.2.2", "@tanstack/eslint-plugin-query": "^5.27.7", "@types/google.maps": "^3.55.4", "@types/leaflet": "^1.9.8", "@types/lodash.capitalize": "^4.2.9", "@types/lodash.debounce": "^4.0.9", "@types/lodash.isequal": "^4.5.8", "@types/mapbox__mapbox-gl-draw": "^1.4.6", "@types/mapbox-gl": "^3.1.0", "@types/node": "^20.11.27", "@types/react": "^18.2.65", "@types/react-dom": "^18.2.22", "@types/react-plotly.js": "^2.6.3", "@types/supercluster": "^7.1.3", "chromatic": "^11.0.8", "encoding": "^0.1.13", "eslint": "^8.57.0", "eslint-config-next": "^14.1.3", "eslint-config-prettier": "^9.1.0", "eslint-plugin-storybook": "^0.8.0", "husky": "^9.0.11", "lint-staged": "^15.2.2", "msw": "^1.3.2", "msw-storybook-addon": "^1.10.0", "storybook": "^8.0.0", "typescript": "^5" }, ```

Took first 6 mins. Den ran bun upgrade --canary and now it took 3 mins. npm used 20secs.

itsjustjo96 commented 4 months ago

Same for me sadly when running this simple command bun create expo webapp under MacOS Sonoma. The first steps takes several minutes already and I didn't make it past step 6 which by then already took around 15-20mins.

image

Interestingly upgrading to the canary version bun upgrade --canary and restarting the mac also helped with my issue and now it's blazingly fast again!

tridge commented 3 months ago

"bun install" on this project took 10 hours for me before I gave up: https://github.com/am32-firmware ubuntu 22.04, node 20.15.1, bun 1.1.20

benhancock-com commented 2 months ago

Confirming this still appears to be an issue.

Running bun install --frozen-lockfile --production in my dockerfile takes over 4 minutes to complete.

Running bun 1.1.21 on macOS arm64.

yairyairyair commented 2 months ago

+1 still relevant, using oven/bun:1.1.24-alpine