asdf icon indicating copy to clipboard operation
asdf copied to clipboard

bug: reshim does not update asdf path

Open axelson opened this issue 3 years ago • 25 comments

Describe the Bug

jason@Jasons-Work-MacBook-Air ~/f (jax/webpack-quiet)> echo $ASDF_DIR
/opt/homebrew/Cellar/asdf/0.9.0/libexec
jason@Jasons-Work-MacBook-Air ~/f (jax/webpack-quiet)> cat ~/.asdf/shims/dotenv
#!/usr/bin/env bash
# asdf-plugin: ruby 3.0.2
exec /opt/homebrew/Cellar/asdf/0.8.1_1/libexec/bin/asdf exec "dotenv" "$@"
jason@Jasons-Work-MacBook-Air ~/f (jax/webpack-quiet)> asdf reshim ruby
jason@Jasons-Work-MacBook-Air ~/f (jax/webpack-quiet)> cat ~/.asdf/shims/dotenv
#!/usr/bin/env bash
# asdf-plugin: ruby 3.0.2
exec /opt/homebrew/Cellar/asdf/0.8.1_1/libexec/bin/asdf exec "dotenv" "$@"

Might be related to #1103

Steps to Reproduce

Before upgrading to 0.9.0 via homebrew:

  1. Install ruby via asdf
  2. gem install dotenv
  3. Update asdf to 0.9.0 via homebrew
  4. Run asdf reshim ruby
  5. Path in ~/.asdf/shims/dotenv is still incorrect

Note: Untested

Expected Behaviour

In step 5 the dotenv shim should have the 0.9.0 path

Actual Behaviour

The path in the dotenv shim has the old 0.8.1 path

Environment

OS:
Darwin Jasons-Work-MacBook-Air.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101 arm64

SHELL:
fish, version 3.3.1

ASDF VERSION:
v0.9.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/opt/homebrew/Cellar/asdf/0.9.0/libexec

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master 63e9cd8
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 9ca2dea
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 95a2091
ruby                         https://github.com/asdf-vm/asdf-ruby.git master de87a40

asdf plugins affected (if relevant)

ruby https://github.com/asdf-vm/asdf-ruby.git master de87a40

axelson avatar Dec 06 '21 19:12 axelson

I appear to be having the same problem. Update: I restarted and was able to use asdf as expected.

Billboz avatar Dec 07 '21 11:12 Billboz

Oof, I restarted and still get:

$ asdf
Unknown command: `asdf `
/usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf: line 82: /usr/local/opt/asdf/lib/commands/command-help.bash: No such file or directory

EDIT: Okay changing the config script invoked per https://github.com/asdf-vm/asdf/issues/1103 fixed this....mostly.

keldin-coding avatar Dec 07 '21 21:12 keldin-coding

This is broken for me too, and none of the suggestions in https://github.com/asdf-vm/asdf/issues/1103 have helped. My zshrc has:

source /usr/local/opt/asdf/asdf.sh

/usr/local/opt/asdf/asdf.sh looks like:

. /usr/local/Cellar/asdf/0.9.0/libexec/asdf.sh

my $ASDF_DIR is:

echo $ASDF_DIR
/usr/local/opt/asdf/libexec

all of my shims (in ~/.asdf/shims) point to 0.8.1_1, and running asdf reshim doesn't update them, e.g.

/Users/cody/.asdf/shims/npm: line 4: /usr/local/Cellar/asdf/0.8.1_1/libexec/bin/asdf: No such file or directory
/Users/cody/.asdf/shims/npm: line 4: exec: /usr/local/Cellar/asdf/0.8.1_1/libexec/bin/asdf: cannot execute: No such file or directory

cccCody avatar Dec 09 '21 18:12 cccCody

I got it working again by deleting ~/.asdf and reinstalling all plugins/packages 😭

cccCody avatar Dec 09 '21 22:12 cccCody

I have the same bug. I think asdf must use the link /usr/local/bin/asdf in all shims and not the real path ! In all shims i make a search and replace and the job is done.

papilip avatar Dec 10 '21 17:12 papilip

Same issue using fish shell with 0.9.0 installed with homebrew

dylan-hoefsloot avatar Dec 15 '21 10:12 dylan-hoefsloot

This helped me: https://github.com/asdf-vm/asdf/issues/1103#issuecomment-990795248

robgyiv avatar Dec 15 '21 17:12 robgyiv

This is a bug we need to fix. In the meantime https://github.com/asdf-vm/asdf/issues/1103#issuecomment-990795248 is a good workaround that shouldn't cause any future issues for you all.

Stratus3D avatar Dec 20 '21 15:12 Stratus3D

I just updated asdf via brew and everything seems broken.

I opened up the ~/.asdf/shims directory in vscode and it looks like nothing is shimmed correctly.

I tried running asdf reshim but with no luck.

I'm just going to do a mass replace via VS Code on the directory 🤷 image

Edit: Reading the above comment this is much cleaner:

rm ~/.asdf/shims/*
asdf reshim

ctsstc avatar Jan 20 '22 23:01 ctsstc

Same here, I installed asdf as root, then copied installed files to non-root user. When doing asdf reshim, path were not changed. As @ctsstc suggested, remove shims before reshim solves it.

trompx avatar Feb 03 '22 14:02 trompx

For the record, https://github.com/asdf-vm/asdf/pull/893 attempted to fix this, but I think it was closed because folks wanted to focus on making reshimming unnecessary.

jfly avatar Apr 08 '22 16:04 jfly

Had similar problem after a program reinstalled asdf. This ended up doing the trick:

unset ASDF_DIR

ghost avatar Apr 17 '22 05:04 ghost

I just updated asdf via brew and everything seems broken.

I opened up the ~/.asdf/shims directory in vscode and it looks like nothing is shimmed correctly.

I tried running asdf reshim but with no luck.

I'm just going to do a mass replace via VS Code on the directory 🤷 image

Edit: Reading the above comment this is much cleaner:

rm ~/.asdf/shims/*
asdf reshim

Thank you!

rogeriomq avatar Apr 18 '22 15:04 rogeriomq

@rogeriomq, do your shims now mention asdf 10.9.0 in them? If so, that's wrong, you'll run into the same problem the next time you upgrade asdf. Your shims are actually supposed to not mention the asdf version in them. See https://github.com/asdf-vm/asdf/issues/1103#issuecomment-1093094933 for details.

jfly avatar Apr 18 '22 16:04 jfly

Had similar problem after a program reinstalled asdf. This ended up doing the trick:

unset ASDF_DIR

@mat-release I found this only worked temporarily. Once I closed the terminal and opened a new one, the behavior persisted.

wrburgess avatar Apr 18 '22 18:04 wrburgess

@ctsstc That did it! Thanks man!

TheMoonDawg avatar Apr 29 '22 18:04 TheMoonDawg

@ctsstc That did it! Thanks man!

I just had to do this again recently and couldn't find this old thread lol.

ctsstc avatar Apr 29 '22 19:04 ctsstc

Had the same issue with 0.10.0, this helped https://github.com/asdf-vm/asdf/issues/1115#issuecomment-1018009184

matisnape avatar May 11 '22 11:05 matisnape

@matisnape @TheMoonDawg @ctsstc, your shims actually are not supposed to mention the version of asdf you use, but it's tricky to install asdf correctly so that that's the case. See my comment here for more details: https://github.com/asdf-vm/asdf/issues/1103#issuecomment-1093094933

jfly avatar May 11 '22 12:05 jfly

I also have completely same issue when I updated asdf from 0.9.0 to 0.10.1.

➜ node
/Users/*/.asdf/shims/node: line 3: /opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: No such file or directory
/Users/*/.asdf/shims/node: line 3: exec: /opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: cannot execute: No such file or directory
➜ npm
/Users/*/.asdf/shims/npm: line 3: /opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: No such file or directory
/Users/*/.asdf/shims/npm: line 3: exec: /opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: cannot execute: No such file or directory
➜ asdf global nodejs 17.4.0
/Users/*/.asdf/shims/node: line 3: /opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: No such file or directory
/Users/*/.asdf/shims/node: line 3: exec: /opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: cannot execute: No such file or directory

SokichiFujita avatar May 19 '22 16:05 SokichiFujita

@SokichiFujita Try to remove old shims and reshim asdf

rm -f ~/.asdf/shims/*
asdf reshim

alekgrischenko avatar May 20 '22 12:05 alekgrischenko

@alekgrischenko I tried only the asdf reshim yesterday. But it did not remove the error. Then I tried the classical solution: uninstalled and reinstalled the all of asdf assets 😄 Right now, asdf works fine. Anyway, thank you 👍

SokichiFujita avatar May 20 '22 13:05 SokichiFujita

Removing old shims and then asdf reshim worked nicely!

rm ~/.asdf/shims/* asdf reshim

kaloyanBozhkov avatar May 31 '22 08:05 kaloyanBozhkov

I have a PR to fix reshim. Was actually a really simple fix https://github.com/asdf-vm/asdf/pull/1311

dylan-chong avatar Jul 25 '22 11:07 dylan-chong

For me, I was having the issue when running terraform, so i did this asdf reshim ruby.

I then checked this directory ~/.asdf/shims/terraform and realised that there was a new file path in there as seen below

#!/usr/bin/env bash
# asdf-plugin: terraform 0.12.21
# asdf-plugin: terraform 0.13.6
# asdf-plugin: terraform 0.14.7
# asdf-plugin: terraform 1.0.0
# asdf-plugin: terraform 1.2.1
exec /usr/local/Cellar/asdf/0.10.2/libexec/bin/asdf exec "terraform" "$@" # asdf_allow: ' asdf '

I noticed terraform was refferring to an older file as seen below

/usr/local/bin/terraform: line 3: /usr/local/Cellar/asdf/0.8.1_1/libexec/bin/asdf: No such file or directory

So I went into /usr/local/bin/terraform and noticed it was the one calling the file that wasn't available, so i edited the file /usr/local/bin/terraform using the vi command and replaced the version number with the version number i found in ~/.asdf/shims/terraform i.e. /usr/local/Cellar/asdf/0.10.2/libexec/bin/asdf which was available in ~/.asdf/shims/terraform and then it worked.

promiseuche avatar Sep 08 '22 23:09 promiseuche