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

solargraph command not found despite being in gemfile #41

Open
Nitrodist opened this issue Aug 18, 2020 · 2 comments
Open

solargraph command not found despite being in gemfile #41

Nitrodist opened this issue Aug 18, 2020 · 2 comments

Comments

@Nitrodist
Copy link

I've tried to use the solargraph server that coc.nvim + coc-solargraph tries to launch but I get this almost every time and configuration I use:

[coc.nvim] Failed to start Solargraph: Gem::Exception: can't find executable solargraph for gem solargraph. solargraph is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
  /Users/mark.campbell/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:462:in `block in replace_bin_path'
  /Users/mark.campbell/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
  /Users/mark.campbell/.asdf/installs/ruby/2.5.1/bin/solargraph:23:in `<top (required)>'

I'm using asdf for ruby/rails and zsh as my shell (presumably.. I have no idea how to check which shell the coc.nvim or coc-solargraph actually invokes). My .zprofile has a line for the asdf plugin and even an extra line to shove in where the bin path is to ensure it's correct.

Running bundle exec solargraph socket and setting the coc-solargraph config to 'transport' works well enough. It's a bit of a pain to do it though, but it's a workaround that works.

I've spent a fair amount of time trying to debug it with different useBundler settings and commandPath settings etc. all to no avail and it's a bit frustrating haha.

@chemzqm
Copy link
Member

chemzqm commented Aug 21, 2020

Install solargraph globally and make sure you can execute solargraph in your shell.

@lightcap
Copy link

lightcap commented Jan 2, 2021

It seems like global (to your ruby version) is the only real option if you're not using rvm or rbenv. Using chruby would be possible if the bundlerPath config option would handle environment vars like $GEM_HOME.

At least that's my quick take. If someone wants to validate that I can look at making a PR.

Here's the line that makes it clear that it's not going to expand any vars that aren't explicitly replaced.

_config.bundlerPath = config.bundlerPath?.replace('~', process.env.HOME) || 'bundle'

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

No branches or pull requests

3 participants