jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.93k stars 286 forks source link

Bun plugin does not set `bun/bin` path like it does for go and python #1811

Open ferntheplant opened 7 months ago

ferntheplant commented 7 months ago

Describe the bug After successfully installing bun with mise use -g bun and installed some global package like bun add -g @biomejs/biome I cannot run biome directly from my shell via $ biome --version because ~/.bun/bin is not on my $PATH

For example with go I can install go with mise, run go install <some package>, and immediately be able to run the package in my shell with <some package> --version

To Reproduce From a fresh mise install run the following

~$ mise use -g bun
~$ mise use -g go
~$ bun add -g @biomejs/biome
~$ biome --version
zsh: command not found: biome
~$ .bun/bin/biome --version
Version: 1.6.1
~$ go install github.com/tomwright/dasel/v2/cmd/dasel@master
~$ dasel --version
dasel version development-v2.7.1-0.20240318190008-1cbdc830b263

Expected behavior I would expect globally installed bun packages to be accessible in my shell by having ~/.bun/bin on my path. The official bun install script sets this for you and emits a command to add to your bashrc in case the automatic path update didn't work.

mise doctor output

version: 2024.3.7 linux-x64 (3bde772 2024-03-21)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Thu, 21 Mar 2024 00:54:44 +0000
  Rust Version: rustc 1.76.0 (07dca489a 2024-02-04)
  Profile: release

shell:
  /usr/bin/zsh
  zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:
  ~/.config/mise/config.toml
  ~/dotfiles/.mise.toml

plugins:
  bun      (core)
  deno     (core)
  fzf      https://github.com/kompiro/asdf-fzf.git#d19eb67
  go       (core)
  java     (core)
  lazygit  https://github.com/nklmilojevic/asdf-lazygit.git#78e04f1
  node     (core)
  python   (core)
  ruby     (core)
  shfmt    https://github.com/luizm/asdf-shfmt.git#a42c5ff

toolset:
  fzf@0.48.1
  shfmt@3.8.0
  lazygit@0.40.2
  go@1.22.1
  python@3.10.6
  node@21.7.1
  bun@1.0.33

env_vars:
  MISE_SHELL=zsh

settings:
  activate_aggressive = true
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = false
  python_default_packages_file = "/home/fjorn/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

1 problem found:

1. shims are missing, run mise reshim to create them
   Missing shims: dasel

The dasel shim missing is irrelevant to the bun bin packages not being on path

Additional context Add any other context about the problem here.

jdx commented 7 months ago

npm adds symlinks to ~/.local/share/mise/installs/node/18/bin/ and that's typical behavior for languages in mise. This effectively locks the node version to the globally installed packages which is useful in case they're not compatible with future versions. That said it is annoying because updating node versions gets rid of all of your global packages.

It looks like we could probably retain this behavior via something that uses the install.globalDir config, though I didn't see an env var way to configure that at first glance. Even that would require a shim though, so it wouldn't be ideal.

@Jarred-Sumner any thoughts on the best way to support bun? Can we use a single directory for all bun versions? Will bun be compatible with packages installed with different bun versions?

I am a little hesitant to use ~/.bun just because no other language uses a global directory like that but it could probably be done.

ferntheplant commented 7 months ago

Ah yea that makes sense - I'm not really used to considering having multiple versions installed simultaneously so the global ~.bun/bin dir didn't seem like a concern. For now I manually added it to my path so I can use global bun packages and I don't plan on having multiple bun version simultaneously installed so it won't cause any issues.

I guess optimally bun would place it's bin dir alongside itself like does golang and python.