Asdf: "No version is set" when version is set and returned by `asdf current`.

Created on 21 Mar 2019  路  27Comments  路  Source: asdf-vm/asdf

Steps to reproduce

I'm setting up a dockerfile based on alpine linux for an elixir build environment.
Here is an example session:

$ echo $PATH
/root/.asdf/bin:/root/.asdf/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.0
<clones asdf...>
$ asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
<installs elixir plugin...>
$ asdf install elixir 1.8
==> Copying release into place
$ asdf global elixir 1.8
$ asdf current
elixir         1.8      (set by /root/.tool-versions)
$ which elixir
/root/.asdf/shims/elixir
$ asdf which elixir
asdf: No version set for command elixir
you might want to add one of the following in your .tool-versions file:
$ elixir
asdf: No version set for command elixir
you might want to add one of the following in your .tool-versions file:

Expected behavior

asdf which elixir should return version 1.8 and elixir should execute the binary.

Actual behavior

asdf: No version set for command elixir
you might want to add one of the following in your .tool-versions file:

Environment

OS: Alpine Linux in a docker container

asdf version: 0.7.0

Here is the WIP Dockerfile:

FROM alpine:3.9

ENV ASDF_VERSION "v0.7.0"
ENV ERLANG_VERSION "21.3"
ENV ELIXIR_VERSION "1.8"

RUN apk add --update --no-cache bash git curl perl alpine-sdk autoconf ncurses ncurses-dev && \
      git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch $ASDF_VERSION && \
      echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc

SHELL ["/bin/bash", "-ic"]

RUN asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git && \
      asdf install elixir $ELIXIR_VERSION && \
      asdf global elixir $ELIXIR_VERSION


ENTRYPOINT bash 

Most helpful comment

Maybe try asdf reshim? If that version is installed and you've set that version in your directory it should work. If this issue manifests in multiple directories or across multiple plugins (e.g. elixir, python, etc...) please open a new issue.

All 27 comments

I am getting this in a lot of languages after updating to the latest ver.

example:

$ cat .tool-versions
elixir 1.8.0
erlang 21.2
nodejs 8.11.3
$ asdf install
elixir 1.8.0 is already installed
erlang 21.2 is already installed
nodejs 8.11.3 is already installed
$ erl
asdf: No version set for command erl
you might want to add one of the following in your .tool-versions file:

erlang 21.0
erlang 21.2.2

Could you give it a try on master and let us know how that goes please?

Same results on master:

bash-4.4# pwd
/root/.asdf
bash-4.4# git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
bash-4.4# asdf current
elixir         1.8      (set by /root/.tool-versions)
bash-4.4# asdf which elixir
asdf: No version set for command elixir
you might want to add one of the following in your .tool-versions file:

I downgraded to 0.6.3, and it's working there:

bash-4.4# git log -1 | cat
commit 1886e00cf18f5e9d3c5ac1bd18426d04121d4472
Author: John Doe <[email protected]>
Date:   Sat Jan 19 09:14:56 2019 -0500

    Update version to 0.6.3
bash-4.4# asdf which elixir
/root/.asdf/installs/elixir/1.8/bin/elixir

Thanks for trying out. I will take a closer look.

@adamu Thanks a lot for the report and the Dockerfile.
This should now be fixed. Could you give it another try and let me know how it goes please?
Thank you.

@hez Could you please check if your issue is fixed on the master branch please? If it is not, could you please open another issue with a little more information about your environment. Thank you.

Works on master for me.

bash-4.4# echo $ASDF_VERSION
master
bash-4.4# asdf which elixir
/root/.asdf/installs/elixir/1.8/bin/elixir

I don't really want to depend on master though, so I hope you will release 0.7.1 馃檭

Yes, we'll release a new version very soon!

Just a note that I also had this issue, tested against master and now it works.

馃憤looks to be resolved in the latest ver

Thanks for your help! 0.7.1 should work how you expect!

Hey @danhper , I'm still having this same issue with asdf version 0.7.1 and ruby. I've got my .ruby-version file in the directory, and my ~/.asdfrc has legacy_version_file = yes. I'm on a Mac running High Sierra, and the required Ruby version is installed. Additionally, even if I create a .tool-versions file, I still get the "No version set for command ruby" error message.

image

@bowmanmike it looks like you've specified Ruby version 2.3.4 but don't have that version installed (see the list in your screenshot that printed with you ran ruby --version). Installing that version of Ruby should fix the issue. Feel free to create another issue to improve the error message here. The version is set, but that version is not installed. The message could definitely be improved.

@Stratus3D I do have 2.3.4 installed, as shown here:
image

Maybe try asdf reshim? If that version is installed and you've set that version in your directory it should work. If this issue manifests in multiple directories or across multiple plugins (e.g. elixir, python, etc...) please open a new issue.

That seemed to work! Thanks!

still having this issue with v0.7.1 even after asdf reshim

I'm getting

$ iex
asdf: No version set for command iex
you might want to add one of the following in your .tool-versions file:

elixir 1.4.4
elixir 1.7.4
elixir 1.8.0
elixir 1.8.1

and my .tool-versions is

erlang 21.0.6
elixir path:/home/eksperimental/elixir/

@eksperimental Could you open another issue please? I suppose there has been a regression for how we handle path: versions.

I installed a new version of elixir, then I updated asdf, and now I get the error:

~$ iex
asdf: No version set for command iex
you might want to add one of the following in your .tool-versions file:
elixir 1.6.6

More info:

~$ asdf --version
v0.7.2

~$ asdf list elixir
  1.6.6
  1.8.2

~$ asdf current
elixir         1.8.2    (set by /Users/7stud/.tool-versions)
erlang         20.3     (set by /Users/7stud/.tool-versions)

~$ iex
asdf: No version set for command iex
you might want to add one of the following in your .tool-versions file:

elixir 1.6.6
~$ 

And, here is .tool-versions (which I have never touched):

~$ cat .tool-versions 
elixir 1.8.2
erlang 20.3

OSX 10.13.6

=========

Okay, this worked for me:

$ asdf reshim elixir

@7stud this has been fixed on master in #524
Does it work?

v0.7.2 on a fresh mojave install here, same problem with ruby, reshim does nothing

EDIT sorry just saw "fixed in master" will try to use master

UPDATE - sorry, doesn't seem to be working right for me

> asdf update --head
Already on 'master' (<------ this is because I had gone to ~/.asdf and ran `git checkout master` before seeing the help info on how to do it with the command)
Your branch is up to date with 'origin/master'.
From https://github.com/asdf-vm/asdf
 * branch            master     -> FETCH_HEAD
Already up to date.
Current branch master is up to date.
Updated asdf to latest on the master branch
> asdf reshim ruby  
> ruby -v
asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:

ruby 2.6.3
> asdf local ruby 2.3.3
> cat .tool-versions 
ruby 2.3.3
nodejs 9.11.2
python 3.7.3
> cd ..
> cd -
> ruby -v
asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:

ruby 2.6.3

UPDATE 2 - just noticed I'm working out of a DIR in the new macOS Catalina "macintosh HD - data" faux-partition (I just reformatted my drive, and downgraded back to Mojave, though) - that might have something to do with it - will update!

Update 3 - Sorry again, still doesn't seem to be working

> pwd
/Users/joemsak/work/<project name redacted>
> asdf current ruby
2.3.3    (set by /Users/joemsak/work/<project name redacted>/.tool-versions)
> asdf reshim ruby
> ruby -v
asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:

ruby 2.6.3
> cd ..
work % cd -
~/work/<project name redacted>
> cd /Volumes/Macintosh\ HD/Users/joemsak/work/<project name redacted> 
> asdf reshim ruby
> ruby -v                                                
asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:

ruby 2.6.3
>

Heads up, it might be related to downgrading from the Catalina beta - https://twitter.com/infinitebrkfst/status/1141395765731790848 - my only problem on the beta was how piss-poor Finder was performing: constant beachball for normal tasks such as alt-tabbing from another app to Finder, or selecting a file to highlight it, or closing the finder window

I'm using macOS 10.14.5 Mochave (and I did not even tried to install 10.15), but i'm facing the same issue.

I even tried to remove all previous ruby installations with no luck.

$ cat ~/.tool-versions
ruby 2.6.3
$ asdf list ruby
  --definitions
  2.6.3
$ ruby -v
asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:

ruby 2.6.3

@adamu @danhper Can you, please, re-open the issue? Or it is better to create the new one?

I don't think the issue you are having is the same one as the original one so could you please open a new issue with a description of your problem. Thanks!

Occasionally I got this issue again, with trying to make fresh installation of ruby 2.1.10. (so it was impossible to run bundler with 2.1.10)

It was surprisingly resolved with installing ruby 2.1.9, and after it bundler works in both versions. Maybe it help someone

gem update --system solved for me, incase you messed up your system gems like me

Was this page helpful?
0 / 5 - 0 ratings