bun icon indicating copy to clipboard operation
bun copied to clipboard

Investigate unnecessarily redownloading packages after install on macOS

Open nikivdev opened this issue 3 years ago • 3 comments

What version of Bun is running?

0.3.0

What platform is your computer?

Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64 arm

What steps can reproduce the bug?

Clone repo. And run: bun install.

I get it to finish installing after 6 minutes:

 + [email protected]
 + [email protected]

 1236 packages installed [377.53s]

~/clones/web-public remotes/origin/misc-refactor~38^2~2* 6m 18s
base ❯

If I rm -rf node_modules and run it again. It's still 6+ minutes so no cache gets applied.

How often does it reproduce? Is there a required condition?

Every time.

What is the expected behavior?

Installs should be very fast especially with cache. https://pnpm.io works correctly.

What do you see instead?

Takes a long time. I am also on bad network though during those tests.

Additional information

No response

nikivdev avatar Dec 02 '22 16:12 nikivdev

~/clones/jsonhero-web main
base ❯ bun install
bun install v0.3.0 (074f2369)
 + @cloudflare/[email protected]
 + @remix-run/[email protected]
 + @tailwindcss/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + @apihero/[email protected]
 + @codemirror/[email protected]
 + @codemirror/[email protected]
 + @heroicons/[email protected]
 + @js-temporal/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @radix-ui/[email protected]
 + @radix-ui/[email protected]
 + @radix-ui/[email protected]
 + @radix-ui/[email protected]
 + @remix-run/[email protected]
 + @remix-run/[email protected]
 + @remix-run/[email protected]
 + @swan-io/[email protected]
 + @uiw/[email protected]
 + @xmldom/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
Using 'cloudflare-workers' as a platform value is deprecated. Use 'cloudflare' instead.
HINT: check the `postinstall` script in `package.json`
Successfully setup Remix for cloudflare.

 1230 packages installed [37.98s]

~/clones/jsonhero-web main* 39s
base ❯ rm -rf node_modules/

~/clones/jsonhero-web main*
base ❯ bun install
bun install v0.3.0 (074f2369)
 + @cloudflare/[email protected]
 + @remix-run/[email protected]
 + @tailwindcss/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + @apihero/[email protected]
 + @codemirror/[email protected]
 + @codemirror/[email protected]
 + @heroicons/[email protected]
 + @js-temporal/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @jsonhero/[email protected]
 + @radix-ui/[email protected]
 + @radix-ui/[email protected]
 + @radix-ui/[email protected]
 + @radix-ui/[email protected]
 + @remix-run/[email protected]
 + @remix-run/[email protected]
 + @remix-run/[email protected]
 + @swan-io/[email protected]
 + @uiw/[email protected]
 + @xmldom/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
Using 'cloudflare-workers' as a platform value is deprecated. Use 'cloudflare' instead.
HINT: check the `postinstall` script in `package.json`
Successfully setup Remix for cloudflare.

 1230 packages installed [40.02s]

~/clones/jsonhero-web main* 41s
base ❯

Check this @Jarred-Sumner

Caching fully broken for me.

Is repo, first time doing clone on it https://github.com/apihero-run/jsonhero-web

nikivdev avatar Dec 02 '22 18:12 nikivdev

This is working for me on Bun v0.3 on an M1 Mac. @nikitavoloboev are you still experiencing this?

colinhacks avatar Dec 07 '22 21:12 colinhacks

@colinhacks

ok just tried it again on https://github.com/Xiphe/cachified (first time cloning repo). I upgraded to latest bun with bun upgrade --canary before doing this test and on 13.0.1 M1 macOS

bun install
bun install v0.3.0 (42ea8b24)
  🔍 bs-logger [17/39]
error: package "redis4" not found registry.npmjs.org/redis4 404
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
$ bun run build:declarations && bun run build:esm && bun run build:cjs
$ tsc && rm dist/cachified.spec.d.ts
$ esbuild src/index.ts --outfile=dist/index.js --format=esm --bundle --target=es2020 --sourcemap --minify

  dist/index.js       7.3kb
  dist/index.js.map  40.9kb

⚡ Done in 7ms
$ esbuild src/index.ts --outfile=dist/index.cjs --format=cjs --bundle --target=es2016 --sourcemap

  dist/index.cjs      20.3kb
  dist/index.cjs.map  41.4kb

⚡ Done in 4ms

 289 packages installed [28.28s]

rm -rf node_modules/
bun install
bun install v0.3.0 (42ea8b24)
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
$ bun run build:declarations && bun run build:esm && bun run build:cjs
$ tsc && rm dist/cachified.spec.d.ts
$ esbuild src/index.ts --outfile=dist/index.js --format=esm --bundle --target=es2020 --sourcemap --minify

  dist/index.js       7.3kb
  dist/index.js.map  40.9kb

⚡ Done in 6ms
$ esbuild src/index.ts --outfile=dist/index.cjs --format=cjs --bundle --target=es2016 --sourcemap

  dist/index.cjs      20.3kb
  dist/index.cjs.map  41.4kb

⚡ Done in 3ms

 289 packages installed [10.95s]

rm -rf node_modules/
bun install
bun install v0.3.0 (42ea8b24)
 + @types/[email protected]
 + @types/[email protected]
 + @types/[email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
 + [email protected]
$ bun run build:declarations && bun run build:esm && bun run build:cjs
$ tsc && rm dist/cachified.spec.d.ts
$ esbuild src/index.ts --outfile=dist/index.js --format=esm --bundle --target=es2020 --sourcemap --minify

  dist/index.js       7.3kb
  dist/index.js.map  40.9kb

⚡ Done in 7ms
$ esbuild src/index.ts --outfile=dist/index.cjs --format=cjs --bundle --target=es2016 --sourcemap

  dist/index.cjs      20.3kb
  dist/index.cjs.map  41.4kb

⚡ Done in 3ms

 289 packages installed [17.09s]

in short, first time is 28s, then 11s, then 17s. I rm -rf node_modules inbetween runs. So I'd think it doesn't work as I'd expect faster installs, like it all should be cached in my view, 17s is still too long time, maybe I am mistaken though.

@Jarred-Sumner can maybe say if those times are a bug or not.

nikivdev avatar Dec 07 '22 22:12 nikivdev

This issue was fixed many releases ago. If you can still reproduce this with Bun v1.0.x, please feel free to re-open this issue.

Electroid avatar Oct 25 '23 19:10 Electroid