Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
barberj opened this issue Aug 5, 2019 · 55 comments
Closed
Labels

Comments

@barberj
Copy link

barberj commented Aug 5, 2019

Following advice from #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
@afeld
Copy link

afeld commented Aug 6, 2019

Try running hash -r, then trying again. asdf-vm/asdf-ruby#48 (comment)

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?

@barberj
Copy link
Author

barberj commented Aug 6, 2019

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

@yordis
Copy link

yordis commented Aug 10, 2019

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.

@JamesLavin
Copy link

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.

@bowmanmike
Copy link

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.

@ttilberg
Copy link

ttilberg commented Sep 26, 2019

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.

@betogrun
Copy link

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

@fahmifan
Copy link

fahmifan commented Oct 3, 2019

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

cat ~/.tool-versions
nodejs 10.15.3

@betogrun
Copy link

betogrun commented Oct 3, 2019

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.

@christopher-dG
Copy link

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.

@heydonovan
Copy link

heydonovan commented Nov 5, 2019

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.

@webkay
Copy link

webkay commented Nov 16, 2019

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

@tispratik
Copy link

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

@yordis
Copy link

yordis commented Dec 31, 2019

When you google the problem and realized your answer is how you fix it: #557 (comment) 😆 😆 😆 😆 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
Copy link

yordis commented Dec 31, 2019

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
Copy link

yordis commented Dec 31, 2019

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

@brock-noah
Copy link

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.

@pdgonzalez872
Copy link

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
Copy link

My issue above was solved here: #662 (comment). 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 !

@kaka-ruto
Copy link

gem update --system solved for me

@jthegedus
Copy link
Contributor

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

@betogrun
Copy link

betogrun commented Sep 8, 2020

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.

@meymeynard
Copy link

meymeynard commented Oct 17, 2020

Also happened to me, solved it by just using

asdf reshim ruby

@wliang002
Copy link

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

@amandaclarck
Copy link

amandaclarck commented Nov 30, 2020

For me what it worked:

  • 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...

@pravin
Copy link

pravin commented Apr 19, 2021

try asdf reshim

Unfortunately didn't work (tried reshim in the pasted code above). Any other suggestions?

@jthegedus
Copy link
Contributor

@pravin have you run asdf install python 2.7.18? 3.9.4 is found on your system, but not the version set in your .tool-versions file.

If that does not work and no suggestions in this thread solve the issue for you, can you open a new issue?

@jthegedus jthegedus changed the title "No version is set" when version is set and returned by asdf current. "No version is set" when version is set and returned by asdf current [ruby] Apr 26, 2021
@RobLoach
Copy link

asdf global <plugin> latest fixed it for me.

@willyjie23
Copy link

gem install rails --your_version fixed it for me.

@surhidamatya
Copy link

I faced the same issue for node what I did was

  1. Create .tool-versions in home directory
  2. asdf global nodejs 16.13.0

and it fixed the issue
Note: I am using M1 Mac mini

@ealasgarov
Copy link

you need to set a version in a format "asdf global package-name 0.0.0"

@oviliz
Copy link

oviliz commented Jun 21, 2022

This is just rubbish...

@dbrtly-upguard
Copy link

I faced the same issue for node what I did was

  1. Create .tool-versions in home directory
  2. asdf global nodejs 16.13.0

and it fixed the issue Note: I am using M1 Mac mini

In my case it was direnv 2.32.1.
Would help if there was a suggestion to append the global version file on install of a plugin.

@Joseph-Burke
Copy link

Joseph-Burke commented Aug 10, 2022

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.

This helped me get my solution. I was trying to run rails new, which only started working after gem install rails and gem install rails

@trufan-poe
Copy link

Has this problem with nodejs and yarn. I ran yarn install and got that error. Reinstalling yarn with asdf resolved the problem. The previous yarn I used was installed via npm.

@liyicky
Copy link

liyicky commented Nov 29, 2022

I had to uninstall the older version I was using in order to get things working again.


No preset version installed for command foreman
Please install a version by running one of the following:

asdf install ruby 3.1.2

or add one of the following versions in your config file at /Users/liyicky/.tool-versions
ruby 3.1.0

asdf uninstall ruby 3.1.0

@fredrivett
Copy link

For those that miss the obvious (like me), if you're trying to install dependencies with yarn then remember to actually install yarn for that version of node before trying to use it, with npm install -g yarn:

$ asdf install nodejs 16.3.0

$ yarn
> No preset version installed for command yarn
> Please install a version by running one of the following:
> asdf install nodejs 16.3.0
> or add one of the following versions in your config file at /[redacted]/.tool-versions
nodejs 16.18.1

$ node -v
> 16.3.0

$ npm install -g yarn

$ yarn
> // successfully installs

@jthegedus
Copy link
Contributor

Just to add to what @fredrivett suggested, asdf has a plugin for Yarn, so your version of Yarn and Node.js can be managed independently instead of having to re-install yarn globally each time you change node version.

@kenny-evitt
Copy link
Contributor

I ran into this issue (or rather a relative of it) just now with Node.js (and Gulp) and what seems to have worked was to run asdf reshim nodejs VERSION where VERSION is the (new) version I wanted to use:

✔ ~/my_code [my-branch|✚ 1] 
(ins)15:34 $ asdf shim-versions gulp
nodejs 6.11.4
nodejs 12.18.3
✔ ~/my_code [my-branch|✚ 1] 
(ins)15:34 $ asdf reshim nodejs 19.8.1
✔ ~/my_code [my-branch|✚ 1] 
(ins)15:35 $ asdf shim-versions gulp
nodejs 6.11.4
nodejs 12.18.3
nodejs 19.8.1

@DRAKYULA
Copy link

DRAKYULA commented Apr 6, 2023

I ran into this issue and tried all of the above solutions, as well as some that my co-workers suggested, like removing ~/.asdf/shims. None of the above worked. Eventually, what seemed to work for me was removing the asdf ruby plugin (asdf plugin remove ruby), adding it back (asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git ), and re-installing ruby (also gem install bundler and bundle install) and finally re-running the command I was trying to in the first place. Hopefully this helps someone in the future!

@assadk88
Copy link

I ran into this issue and tried all of the above solutions, as well as some that my co-workers suggested, like removing ~/.asdf/shims. None of the above worked. Eventually, what seemed to work for me was removing the asdf ruby plugin (asdf plugin remove ruby), adding it back (asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git ), and re-installing ruby (also gem install bundler and bundle install) and finally re-running the command I was trying to in the first place. Hopefully this helps someone in the future!

This was the only thing that worked for me too – thanks!

@m-graf
Copy link

m-graf commented Apr 25, 2023

For those that miss the obvious (like me), if you're trying to install dependencies with yarn then remember to actually install yarn for that version of node before trying to use it, with npm install -g yarn:

$ asdf install nodejs 16.3.0

$ yarn
> No preset version installed for command yarn
> Please install a version by running one of the following:
> asdf install nodejs 16.3.0
> or add one of the following versions in your config file at /[redacted]/.tool-versions
nodejs 16.18.1

$ node -v
> 16.3.0

$ npm install -g yarn

$ yarn
> // successfully installs

This is the only thing that worked. Comical.

@LucasDachman
Copy link

Uninstalling and reinstalling worked for me

asdf uninstall ruby 2.5.3
asdf install ruby 2.5.3

@haider792
Copy link

haider792 commented Oct 29, 2023

if you working on CI/CD pipeline and facing ruby version issue,
press "CMD + SHIFT + ." in your project folder on mac,
you will see the hidden files after that you will be shown .ruby-version file, open it and update the version needed on the CI/CD.
push the code in repo.
everything will be good then

@emmanuelkamala
Copy link

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

Thank you, this solved my problem!

@jsatk
Copy link
Contributor

jsatk commented Jan 16, 2024

I am once again encountering this issue w/ ruby. I've tried everything here (reinstalls, reshims, restarts) still no dice.

@jmjohnson
Copy link

For what it's worth, I encountered this error today; hash -r and asdf reshim ruby worked for me.

But I swear I tried it once and it didn't work.

@corrieleech
Copy link

Adding here for anyone else silly enough to forget, but running bundle install to align your Gemfile.lock with the new version of ruby also helps. 🤦‍♀️

@soubhik-c
Copy link

#557 (comment)
worked for me.

@mateuseap
Copy link

I've tried a lot of solutions, but only the one given in #557 (comment) worked for me. Thanks a lot, @DRAKYULA!

@johndunlap
Copy link

asdf global <plugin> latest fixed it for me.

This worked for me. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests