Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun randomly fails in a Docker container on Mac host #17951

Open
croqaz opened this issue Mar 6, 2025 · 5 comments
Open

Bun randomly fails in a Docker container on Mac host #17951

croqaz opened this issue Mar 6, 2025 · 5 comments
Labels
bug Something isn't working docker An issue that occurs when running in Docker regression

Comments

@croqaz
Copy link

croqaz commented Mar 6, 2025

What version of Bun is running?

1.2.4

What platform is your computer?

Linux 6.8.0-47-generic aarch64 aarch64

What steps can reproduce the bug?

Bun v1.1 had this working but since I upgraded to 1.2, it's more unstable.
There are 2 bugs and the most simple, create a basic console.log file (main2.ts):

console.log('Hello');

Run:

bun main2.ts
# or
bun run ./main2.ts

Error:

error: Module not found '/root/PWD/main2.ts'
Bun v1.2.4 (Linux arm64)

Also await import doesn't work, create main1.ts:

(async () => {
    await import('./main2.ts');
})();

Running bun main1.ts or bun run ./main1.ts raises the same error.

But it seems to be random....?! Is it a caching issue?

What is the expected behavior?

It just work like Bun 1.1.x

What do you see instead?

Errors above

Additional information

Seems to be related to some cache, perhaps the TS files are cached somewhere?

@croqaz croqaz added bug Something isn't working needs triage labels Mar 6, 2025
@DonIsaac
Copy link
Contributor

DonIsaac commented Mar 6, 2025

I cannot reproduce on canary (v1.2.5). Please try upgrading or provide some more details.

platform: Linux 6.12.15-orbstack-00304-gd0ddcf70447d aarch64 aarch64
bun revision: 1.2.5-canary.78+94ab3007a

files:

// main1.ts
import "./main2.ts";
// main2.ts
console.log("hello");

I tried all of these commands, they all worked:

bun main1.ts
bun ./main1.ts
bun run main1.ts
bun run ./main1.ts

@190n
Copy link
Contributor

190n commented Mar 6, 2025

What hardware and distribution are you using? Are you in any kind of container or virtualization environment?

@croqaz
Copy link
Author

croqaz commented Mar 7, 2025

I am in a Docker container on a new Mac;
I have Bun from ASDF (v1.2.4 latest) in Docker and from Brew (v1.1.40) on host. I didn't change anything in my setup for a a very long time, but I didn't update Bun in some time in Docker and now I can't import anything pretty much.

which bun
/root/.asdf/shims/bun

bun --version
1.2.4

cat main1.ts
(async () => {
  if (false) {
    console.log('blah blah');
  } else {
    require('./main3.ts');
  }
})();

cat main2.ts
import "./main3.ts";

cat main3.ts
console.log('Yes');

bun main1.ts
error: Module not found '/root/PWD/main1.ts'
Bun v1.2.4 (Linux arm64)

bun main2.ts
error: Module not found '/root/PWD/main2.ts'
Bun v1.2.4 (Linux arm64)

bun main3.ts
error: Module not found '/root/PWD/main3.ts'
Bun v1.2.4 (Linux arm64)

If I use Bun from Brew (v1.1.40) on host everything works like normal.

EDIT: brew doesn't have Bun, so I installed it manually some time ago.

@croqaz
Copy link
Author

croqaz commented Mar 7, 2025

OK sorry for the noise, it seems to be a problem with Bun in my Docker container or something...
It just randomly fails and I tried with lots of different Bun versions installed from ASDF.
I mean, it's still a big problem for me, but it's completely different than what I said.

Image

@croqaz croqaz changed the title Simple console.log in Bun 1.2.4 Bun randomly fails in a Docker container on Mac host Mar 7, 2025
@croqaz
Copy link
Author

croqaz commented Mar 7, 2025

BTW Deno doesn't have this issue, with the same setup, in the same container:

Image

@RiskyMH RiskyMH added docker An issue that occurs when running in Docker regression and removed needs triage labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker An issue that occurs when running in Docker regression
Projects
None yet
Development

No branches or pull requests

4 participants