asdf
asdf copied to clipboard
bug: reshim does not update asdf path
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:
- Install ruby via asdf
- gem install dotenv
- Update asdf to 0.9.0 via homebrew
- Run
asdf reshim ruby
- 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
I appear to be having the same problem. Update: I restarted and was able to use asdf as expected.
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.
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
I got it working again by deleting ~/.asdf
and reinstalling all plugins/packages 😭
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.
Same issue using fish shell with 0.9.0 installed with homebrew
This helped me: https://github.com/asdf-vm/asdf/issues/1103#issuecomment-990795248
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.
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 🤷
Edit: Reading the above comment this is much cleaner:
rm ~/.asdf/shims/*
asdf reshim
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.
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.
Had similar problem after a program reinstalled asdf. This ended up doing the trick:
unset ASDF_DIR
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 🤷
Edit: Reading the above comment this is much cleaner:
rm ~/.asdf/shims/* asdf reshim
Thank you!
@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.
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.
@ctsstc That did it! Thanks man!
@ctsstc That did it! Thanks man!
I just had to do this again recently and couldn't find this old thread lol.
Had the same issue with 0.10.0, this helped https://github.com/asdf-vm/asdf/issues/1115#issuecomment-1018009184
@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
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 Try to remove old shims and reshim asdf
rm -f ~/.asdf/shims/*
asdf reshim
@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 👍
Removing old shims and then asdf reshim worked nicely!
rm ~/.asdf/shims/* asdf reshim
I have a PR to fix reshim. Was actually a really simple fix https://github.com/asdf-vm/asdf/pull/1311
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.