coc-solargraph icon indicating copy to clipboard operation
coc-solargraph copied to clipboard

asdf: No preset version installed for command solargraph

Open kaka-ruto opened this issue 4 years ago • 6 comments

I had an issue with my Ruby installation using asdf-ruby. So I deleted that installation (Ruby 2.5.1) and reinstalled it.

I also uninstalled all Solargraph gems just incase they were pointing to an old Ruby installation path, and did another gem install solargraph

solargraph -v or opening a Ruby file in Vim throws an error

asdf: No preset version installed for command solargraph
Please install the missing version by running one of the following:

asdf install ruby 2.5.1

I can confirm that the ruby version is installed.

I am using coc-solargraph and tried setting solargraph.commandPath to /Users/kaka/.asdf/shims/solargraph but it didn't work.

I have other Ruby versions (using asdf as well) and their Solargraphs seem to work well

kaka-ruto avatar Jun 23 '20 14:06 kaka-ruto

@chemzqm any recommendations I should try to troubleshoot or give more info?

Here's a screenshot of what I get

Screen Shot 2020-06-25 at 14 18 39

kaka-ruto avatar Jun 25 '20 11:06 kaka-ruto

No idea, should be problem with your ruby environment

chemzqm avatar Jun 26 '20 04:06 chemzqm

Thanks. I'm sure it's my Ruby env. Once I find something helpful I'll report here to help others and future me :)

kaka-ruto avatar Jun 26 '20 11:06 kaka-ruto

Maybe try asdf reshim

Nitrodist avatar Aug 18 '20 17:08 Nitrodist

for me, it was mismatch solargraph version. try gem install solargraph in your project folder. I guess problem come from solargraph was install in another of ruby, then later on, ruby version changed, but it do not update new gem of solargraph

hanh090 avatar Sep 14 '20 04:09 hanh090

If you put solargraph in ~/.default-gems, asdf should install it automatically when you install a new Ruby version.

More info to corroborate what @hanh090 said:

It seems like ~/.asdf/shims/solargraph will include the Ruby versions you've installed that gem through:

#!/usr/bin/env bash
# asdf-plugin: ruby 2.7.2
exec /usr/local/opt/asdf/bin/asdf exec "solargraph" "$@"

So with the shim above, it would work fine on Ruby 2.7.2 via asdf but not on another Ruby version. If I gem install solargraph again with that other Ruby version, it adds an # asdf-plugin: … line for it and solargraph -v will start working.

henrik avatar Sep 16 '21 08:09 henrik