asdf icon indicating copy to clipboard operation
asdf copied to clipboard

"No version is set" when version is set and returned by `asdf current` [ruby]

Open barberj opened this issue 7 years ago • 68 comments

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

barberj avatar Aug 05 '19 20:08 barberj

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?

afeld avatar Aug 06 '19 03:08 afeld

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

barberj avatar Aug 06 '19 13:08 barberj

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.

yordis avatar Aug 10 '19 17:08 yordis

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.

JamesLavin avatar Aug 16 '19 21:08 JamesLavin

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.

bowmanmike avatar Sep 17 '19 14:09 bowmanmike

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.

ttilberg avatar Sep 26 '19 13:09 ttilberg

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

betogrun avatar Sep 27 '19 18:09 betogrun

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

cat ~/.tool-versions
nodejs 10.15.3

fahmifan avatar Oct 03 '19 03:10 fahmifan

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.

betogrun avatar Oct 03 '19 15:10 betogrun

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.

christopher-dG avatar Oct 04 '19 06:10 christopher-dG

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.

heydonovan avatar Nov 05 '19 18:11 heydonovan

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

webkay avatar Nov 16 '19 05:11 webkay

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

tispratik avatar Dec 15 '19 00:12 tispratik

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.

yordis avatar Dec 31 '19 13:12 yordis

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.

yordis avatar Dec 31 '19 15:12 yordis

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 🤷‍♂ 🤦‍♂

yordis avatar Dec 31 '19 15:12 yordis

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.

brock-noah avatar Mar 27 '20 22:03 brock-noah

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?

pdgonzalez872 avatar Jun 12 '20 10:06 pdgonzalez872

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 !

pdgonzalez872 avatar Jun 12 '20 11:06 pdgonzalez872

gem update --system solved for me

kaka-ruto avatar Jun 15 '20 21:06 kaka-ruto