coc-solargraph
coc-solargraph copied to clipboard
asdf: No preset version installed for command solargraph
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
@chemzqm any recommendations I should try to troubleshoot or give more info?
Here's a screenshot of what I get
No idea, should be problem with your ruby environment
Thanks. I'm sure it's my Ruby env. Once I find something helpful I'll report here to help others and future me :)
Maybe try asdf reshim
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
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.