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

[macOS arm64] Installation via bum use fails with Reason: No such file or directory (os error 2) #23

Open
kavsingh opened this issue Jul 27, 2024 · 4 comments

Comments

@kavsingh
Copy link

Re-trying bum on macOS arm64 after #14 (comment)

os: macOS 14.5 (23F79)
chip: M3 Max

installing bum went well

❯ curl -fsSL https://github.com/owenizedd/bum/raw/main/install.sh | bash
######################################################################## 100.0%
x bum-v0.6.1-aarch64-apple-darwin/
x bum-v0.6.1-aarch64-apple-darwin/bum
bum was installed successfully to  /[$HOME]/.bum/bin/bum

~/.zshrc was successfully updated:

# bum
export BUM_INSTALL="$HOME/.bum"
export PATH="$BUM_INSTALL/bin:$PATH"

looked up latest available bun version, all good

❯ bum list-remote
  v1.1.21
  v1.1.20
  v1.1.19
  v1.1.18
  v1.1.17
  v1.1.16
  v1.1.15
  v1.1.14
  v1.1.13
  v1.1.12
  v1.1.11
  v1.1.10
  ...

however attempting to install a bun version failed

without the v

❯ bum use 1.1.21
Bum - installing bun for version 1.1.21...
Extracting zip file...
Failed Err(No such file or directory (os error 2))

with the v

❯ bum use v1.1.21
Bum - installing bun for version 1.1.21...
Extracting zip file...
Failed Err(No such file or directory (os error 2))

with backtrace

❯ RUST_BACKTRACE=1 bum use 1.1.21
Failed to activate Bun v1.1.21
Reason: No such file or directory (os error 2)

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: bum::commands::activate_bun::{{closure}}
   3: bum::commands::use_bun::{{closure}}
   4: bum::run_commands::{{closure}}
   5: tokio::runtime::park::CachedParkThread::block_on
   6: tokio::runtime::context::runtime::enter_runtime
   7: tokio::runtime::runtime::Runtime::block_on
   8: bum::main
   9: std::sys_common::backtrace::__rust_begin_short_backtrace
  10: std::rt::lang_start::{{closure}}
  11: std::rt::lang_start_internal
  12: _main

looking into $HOME/.bum

❯ ls -lahR ~/.bum
total 0
drwxr-xr-x   4 [my user]  staff   128B Jul 27 14:15 .
drwxr-x---+ 71 [my user]  staff   2.2K Jul 27 14:41 ..
drwxr-xr-x   3 [my user]  staff    96B Jul 27 14:15 bin
drwxr-xr-x   5 [my user]  staff   160B Jul 27 14:37 bun-versions

/$HOME/.bum/bin:
total 10272
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:15 .
drwxr-xr-x  4 [my user]  staff   128B Jul 27 14:15 ..
-rwxr-xr-x  1 [my user]  staff   5.0M Jul 24 14:36 bum

/$HOME/.bum/bun-versions:
total 0
drwxr-xr-x  5 [my user]  staff   160B Jul 27 14:37 .
drwxr-xr-x  4 [my user]  staff   128B Jul 27 14:15 ..
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:37 1.1.19
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:37 1.1.20
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:19 1.1.21

/$HOME/.bum/bun-versions/1.1.19:
total 107624
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:37 .
drwxr-xr-x  5 [my user]  staff   160B Jul 27 14:37 ..
-rw-r--r--  1 [my user]  staff    53M Jul 27 14:37 bun

/$HOME/.bum/bun-versions/1.1.20:
total 107624
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:37 .
drwxr-xr-x  5 [my user]  staff   160B Jul 27 14:37 ..
-rw-r--r--  1 [my user]  staff    53M Jul 27 14:37 bun

/$HOME/.bum/bun-versions/1.1.21:
total 106056
drwxr-xr-x  3 [my user]  staff    96B Jul 27 14:19 .
drwxr-xr-x  5 [my user]  staff   160B Jul 27 14:37 ..
-rw-r--r--  1 [my user]  staff    52M Jul 27 14:19 bun

~
❯ find ~/.bum -type f
/$HOME/.bum/bin/bum
/$HOME/.bum/bun-versions/1.1.20/bun
/$HOME/.bum/bun-versions/1.1.19/bun
/$HOME/.bum/bun-versions/1.1.21/bun

~
❯ ls -la ~/.bum/bin/bum
-rwxr-xr-x  1 [my user]  staff  5258312 Jul 24 14:36 /$HOME/.bum/bin/bum

~
❯ ls -la ~/.bum/bun-versions/1.1.21/bun
-rw-r--r--  1 [my user]  staff  54298016 Jul 27 14:19 /$HOME/.bum/bun-versions/1.1.21/bun

also happens when attempting older versions of bun

❯ RUST_BACKTRACE=1 bum use 1.1.19
Bum - installing bun for version 1.1.19...
Extracting zip file...
Failed Err(No such file or directory (os error 2)

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: bum::commands::activate_bun::{{closure}}
   3: bum::commands::use_bun::{{closure}}
   4: bum::run_commands::{{closure}}
   5: tokio::runtime::park::CachedParkThread::block_on
   6: tokio::runtime::context::runtime::enter_runtime
   7: tokio::runtime::runtime::Runtime::block_on
   8: bum::main
   9: std::sys_common::backtrace::__rust_begin_short_backtrace
  10: std::rt::lang_start::{{closure}}
  11: std::rt::lang_start_internal
  12: _main)
@kavsingh
Copy link
Author

kavsingh commented Jul 27, 2024

note that bum remove works despite versions not activated

~echo $BUM_INSTALL
/[$HOME]/.bum

~
❯ bum remove 1.1.21
"/[$HOME]/.bum/bun-versions/1.1.21"
v1.1.21 has been removed.

~
❯ bum remove 1.1.19
"/[$HOME]/.bum/bun-versions/1.1.19"
v1.1.19 has been removed.

~
❯ bum list
thread 'main' panicked at src/bun.rs:21:10:
Failed to execute bun -v, is bun installed?: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

~
❯ bum remove 1.1.20
"/[$HOME]/.bum/bun-versions/1.1.20"
v1.1.20 has been removed.

~
❯ ls ~/.bum/bun-versions

~

but then no dice trying to re-install after remove

~
❯ bum use v1.1.21
Bum - installing bun for version 1.1.21...
Extracting zip file...
Failed Err(No such file or directory (os error 2))

~
❯ ls ~/.bum/bun-versions
1.1.21

~

@kavsingh kavsingh changed the title Installation via bum use fails with Reason: No such file or directory (os error 2) Installation via bum use fails with Reason: No such file or directory (os error 2) Jul 27, 2024
@kavsingh kavsingh changed the title Installation via bum use fails with Reason: No such file or directory (os error 2) [aarch64 apple] Installation via bum use fails with Reason: No such file or directory (os error 2) Jul 27, 2024
@kavsingh kavsingh changed the title [aarch64 apple] Installation via bum use fails with Reason: No such file or directory (os error 2) [macOS arm64] Installation via bum use fails with Reason: No such file or directory (os error 2) Jul 27, 2024
@kavsingh
Copy link
Author

kavsingh commented Jul 27, 2024

it seems to be to do with the usage of BUN_BIN_PATH:

fs::copy(bun_used_path, BUN_BIN_PATH.to_owned()).await?;

the folder "~/.bun/bin" does not exist on my system and does not seem to be created in install.sh

note - i removed my brew installation of bun before retrying bum, so that might have taken out ~/.bun. in any case, the same issue would probably affect anyone who hasn't installed bun before.

i guess there would have to be a exists-or-create step similar to

if fs::metadata(FOLDER_VERSION_BASE.to_owned()).await.is_err() {

or install.sh should create the folder (and add .bun/bin to path in shell profile)?

i tried modifying the code locally to ensure the folder and it seemed to work

❯ bum use v1.1.21
bun used path "/$HOME/.bum/bun-versions/1.1.21/bun"
bun bin path "/$HOME/.bun/bin/bun"
no folder "/$HOME/.bun/bin", creating
Bun v1.1.21 is activated.

@owenizedd
Copy link
Owner

I see that makes sense it might happen if the folder doesn’t exist but bun is available during installation, another solution is if bun is available but folder is not there than create it during installation script.

Do you want to raise PR for the fix?

@h2oearth
Copy link

h2oearth commented Oct 5, 2024

The installation script is still broken on my end :-/. Thanks to @kavsingh for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants