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

Created on 5 Aug 2019  ยท  25Comments  ยท  Source: asdf-vm/asdf

Following advice from https://github.com/asdf-vm/asdf/issues/488, creating new issue.

Steps to reproduce

Install new ruby. Attempt to install dependencies using bundler. Tried new session after install.

Expected behavior

Dependencies are installed.

Actual behavior

โžœ  git:(master) bundle install
asdf: No version set for command bundle
you might want to add one of the following in your .tool-versions file:

ruby 2.6.3
ruby 2.6.1

โžœ git:(master) asdf current
elixir         No version set for elixir; please run `asdf <global | local> elixir <version>`
erlang         No version set for erlang; please run `asdf <global | local> erlang <version>`
ruby           2.5.1    (set by /Users/justinbarber/src/melody/.tool-versions)

โžœ  git:(master) cat .tool-versions
ruby 2.5.1

Environment

OS:

macOS Sierra 10.12.6

asdf version:

โžœ  git:(master) asdf --version
v0.7.3
bug

Most helpful comment

I'm facing the same issue after installing another ruby version with asdf.

$ asdf install ruby 2.4.3
$ asdf local ruby 2.4.3

$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

$ cat .tool-versions 
ruby 2.4.3

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

ruby 2.6.1
ruby 2.6.3

Running asdf reshim ruby and restarted the terminal didn't fix the issue.
asdf version is 0.7.4

As mentioned here, the problem happens because there is no bundler for the new ruby version. Running gem install bundler solves the issue.

All 25 comments

Try running hash -r, then trying again. https://github.com/asdf-vm/asdf-ruby/issues/48#issuecomment-351787183

Maintainers: I think it's worth considering clearing the bash cache (hash -r or hash -d [executable] for each executable) _somewhere_... not sure of the best place for that. I wasn't even aware that bash _did_ caching, and I bet a lot of other people aren't either. Thoughts?

I'm using zsh. hash -r didn't help seem to have any effect.

Same started happening with NodeJS.

โžœ node -v
asdf: No version set for command node
you might want to add one of the following in your .tool-versions file:

nodejs 10.16.1

Worth saying that I had to put .tool-versions in that particular folder closer to where I am trying to use Node by using asdf local nodejs 10.16.1 but I am not sure why.

I'm having the same issue, and I noticed that it seems to happen because asdf doesn't seem to know about a version of Ruby (2.6.3) I installed via asdf today. It recommends I use one of my three previous versions of Ruby:

james@James-Precision-5520:~/Git/elixirschool$ asdf current
elixir         1.9.0-otp-22 (set by /home/james/.tool-versions)
erlang         22.0.7   (set by /home/james/.tool-versions)
ruby           2.6.3    (set by /home/james/.tool-versions)
james@James-Precision-5520:~/Git/elixirschool$ jekyll
asdf: No version set for command jekyll
you might want to add one of the following in your .tool-versions file:

ruby 2.3.7
ruby 2.4.3
ruby 2.5.1
james@James-Precision-5520:~/Git/elixirschool$ ls ~/.asdf/installs/ruby
2.3.7  2.4.3  2.5.1  2.6.3
james@James-Precision-5520:~/Git/elixirschool$ asdf list ruby
  2.3.7
  2.4.3
  2.5.1
  2.6.3

When I changed my .tool-versions to point at one of the other three (older) Ruby installs, it started working.

Hoping this information may help with debugging.

Having a similar issue. I have a Node, Elixir, and Ruby versions all set in my ~/.tool-versions file. When I cd into an Elixir project, asdf current picks up the Elixir and Ruby versions from the global file, but not Node. I can resolve the issue by adding a $PROJECT/.tool-versions file with the correct Node version, but I don't want to pollute a shared repo with a file that only I'm using.

Here's some info about my setup where I have the same issue. I just upgraded asdf as I saw in another issue that it might have been due to an old version, but I still have the issue.

MacOS 10.14.6 Mojave
asdf installed with Brew

ttilberg:~$ which asdf
/usr/local/opt/asdf/bin/asdf

ttilberg:~$ asdf --version
v0.7.4

ttilberg:~$ cat .tool-versions
ruby 2.6.3
nodejs 10.16.0
python 3.7.4

ttilberg:~$ which python
/Users/ttilberg/.asdf/shims/python

ttilberg:~$ which pip
/Users/ttilberg/.asdf/shims/pip

ttilberg:~$ python --version
Python 3.7.4

ttilberg:~$ pip install ipython
Requirement already satisfied: ipython in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (7.8.0)
Requirement already satisfied: pygments in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (2.4.2)
Requirement already satisfied: appnope; sys_platform == "darwin" in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (0.1.0)
Requirement already satisfied: traitlets>=4.2 in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (4.3.2)
Requirement already satisfied: pickleshare in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (0.7.5)
Requirement already satisfied: jedi>=0.10 in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (0.15.1)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (2.0.9)
Requirement already satisfied: setuptools>=18.5 in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (40.8.0)
Requirement already satisfied: decorator in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (4.4.0)
Requirement already satisfied: pexpect; sys_platform != "win32" in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (4.7.0)
Requirement already satisfied: backcall in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from ipython) (0.1.0)
Requirement already satisfied: ipython-genutils in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from traitlets>=4.2->ipython) (0.2.0)
Requirement already satisfied: six in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from traitlets>=4.2->ipython) (1.12.0)
Requirement already satisfied: parso>=0.5.0 in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from jedi>=0.10->ipython) (0.5.1)
Requirement already satisfied: wcwidth in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython) (0.1.7)
Requirement already satisfied: ptyprocess>=0.5 in ./.asdf/installs/python/3.7.4/lib/python3.7/site-packages (from pexpect; sys_platform != "win32"->ipython) (0.6.0)

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

python 3.6.8


ttilberg:~$ which ipython
/Users/ttilberg/.asdf/shims/ipython

ttilberg:~$ cat $(which ipython)
#!/usr/bin/env bash
# asdf-plugin: python 3.6.8
exec /usr/local/opt/asdf/bin/asdf exec "ipython" "$@"

The shim explicitly mentions py 3.6.8 in a comment -- I'm not sure if that's a magic comment, I'm guessing so. Being that my python seems to be correctly pointed to asdf+3.7 for all the above commands, I feel like something in this last file is amiss.

__EDIT:__ The issue above was resolved by running asdf reshim.

I'm facing the same issue after installing another ruby version with asdf.

```
$ asdf install ruby 2.4.3
$ asdf local ruby 2.4.3

$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

$ cat .tool-versions
ruby 2.4.3

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

ruby 2.6.1
ruby 2.6.3
`` Runningasdf reshim ruby` and restarted the terminal didn't fix the issue.
asdf version is 0.7.4

I also get this issue for nodejs in mac, i solve it by adding .tool-versions

cat ~/.tool-versions
nodejs 10.15.3

I'm facing the same issue after installing another ruby version with asdf.

$ asdf install ruby 2.4.3
$ asdf local ruby 2.4.3

$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

$ cat .tool-versions 
ruby 2.4.3

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

ruby 2.6.1
ruby 2.6.3

Running asdf reshim ruby and restarted the terminal didn't fix the issue.
asdf version is 0.7.4

As mentioned here, the problem happens because there is no bundler for the new ruby version. Running gem install bundler solves the issue.

Having this issue with Julia 1.3.0-rcX (for X = 1:3). as well as 1.1.0-rc2. I've never had any issues with normal x.y.z versions.

I'm experiencing the same with the terraform plugin. This just started happening this week:

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

terraform 0.12.2
terraform 0.12.3
terraform 0.12.5
terraform 0.12.6
terraform 0.12.7
terraform 0.12.8
$ cat ~/.tool-versions
helm 2.9.1
terraform 0.12.13

Adding it to the file instructed has no effect.

In my case, there was an error when I tried gem install bundler

$ gem install bundler
asdf: No version set for command gem

But it was solved by asdf list-all and reinstall

asdf list-all ruby
asdf uninstall ruby 2.6.2
asdf install ruby 2.6.2

I had the same issue after asdf upgrade from 0.7.0 to 0.7.5. Turns out that my shell's rc file was still pointing at the old version.

Before fix
source /usr/local/Cellar/asdf/0.7.0/asdf.fish

After fix
source /usr/local/Cellar/asdf/0.7.5/asdf.fish

When you google the problem and realized your answer is how you fix it: https://github.com/asdf-vm/asdf/issues/557#issuecomment-520164704 ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜† classic

Any updates on this?

Also, I am doing the following in my zsh

if [[ -f "$HOME/.asdf/asdf.sh" ]] then
  source "$HOME/.asdf/asdf.sh"
  source "$HOME/.asdf/completions/asdf.bash"
fi

Therefore, I don't think I am running into the issue that @tispratik ran into.

Something I found, doing asdf current

โžœ asdf current
elixir         1.9.1    (set by /Users/ubi/.tool-versions)
erlang         22.0     (set by /Users/ubi/.tool-versions)
golang         1.13.5   (set by /Users/ubi/.tool-versions)
nodejs         version 6.10 is not installed for nodejs 
rust           1.28.0   (set by /Users/ubi/.tool-versions)

This is wrong

nodejs         version 6.10 is not installed for nodejs 

In fact I do have NodeJS specify in my .tool-versions

โžœ cat ~/.tool-versions              
erlang 22.0
elixir 1.9.1
nodejs 10.17.0
ruby 2.6.3
clojure 1.10.0
golang 1.13.5
rust 1.28.0

I am not sure where 6.10 is coming from, continue the debugging.

Alright,

I changed ~/.asdfrc

โžœ cat ~/.asdfrc 
legacy_version_file = no

I had yes before.

It seems that now asdf is able to pick ~/.tool-versions correctly now.

And I figured out somebody was using .nvmrc ๐Ÿคทโ€โ™‚ ๐Ÿคฆโ€โ™‚

In relation to NodeJS, my issue was the globally installed yarn was for node v10 and not v12.

I was experiencing something like this even with the version specified.

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

nodejs 12.16.1

This path existed for my previous version of node 10 but not for node 12.

test -e ~/.asdf/installs/nodejs/12.16.1/.npm/lib/node_modules/yarn/ && echo OK || echo NOT FOUND

After asdf local nodejs 12.16.1 a npm install -g yarn resolved my issue.

Hi! I'm on OSX (Mojave 10.14.6) and ran into the following:

~ :> asdf version
v0.7.8-4a3e3d6
~ :> asdf current
elixir         1.9.4    (set by /Users/pdg/.tool-versions)
erlang         22.3.4.1 (set by /Users/pdg/.tool-versions)
~ :> asdf reshim
~ :> cat .tool-versions
erlang 22.3.4.1
elixir 1.9.4
~ :> iex
asdf: No preset version installed for command erl
Please install the missing version by running one of the following:

asdf install erlang 22.3.4.1

or add one of the following in your .tool-versions file:

erlang 22.0.7
erlang 22.2.8
~ :> asdf install erlang 22.3.4.1
erlang 22.3.4.1 is already installed
~ :> rm .tool-versions
~ :> echo "erlang 22.2.8
> elixir 1.9.4" > .tool-versions
~ :> cat .tool-versions
erlang 22.2.8
elixir 1.9.4
~ :> iex
Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Interactive Elixir (1.9.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
^C~ :>

Does anyone know how I can set the correct version on .tool-versions?

My issue above was solved here: https://github.com/asdf-vm/asdf/issues/662#issuecomment-643225916. Uninstall, use the correct plugin env vars and then installing it again solved my problem. I believe I had a bad install and had things in a weird state.

Thanks for helping @Stratus3D !

gem update --system solved for me

Is this considered resolved? If not, can someone please rehash the problem clearly for me as I cannot see anything in particular outstanding?

It seems this happened because we forgot to add the packager manager (bundler for ruby, yarn for node) after adding a new version.
I also wrote a post about this: http://blog.albertorocha.me/posts/asdf-ruby-no-version-set
Hope it helps.

Also happened to me, solved it by just using

asdf reshim ruby

Set Current Version: resource: https://asdf-vm.com/#/core-manage-versions
asdf global <name> <version> [<version>...] asdf shell <name> <version> [<version>...] asdf local <name> <version> [<version>...]
global writes the version to $HOME/.tool-versions.
shell set the version to an environment variable named ASDF_${LANG}_VERSION, for the current shell session only.
local writes the version to $PWD/.tool-versions, creating it if needed.

asdf global elixir 1.2.4

For me what it worked was:

  • Reinstall ruby 2.4.4 (the version that I needed)

    • Restart the terminal

    • asdf reshim ruby / asdf reshim

    • gem install bundler

    • bundle install

A mix of everything...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pachun picture pachun  ยท  3Comments

jamesstidard picture jamesstidard  ยท  4Comments

rhiroyuki picture rhiroyuki  ยท  3Comments

gmile picture gmile  ยท  3Comments

jthegedus picture jthegedus  ยท  3Comments