VSCode trying to find find rubocop in the SYSTEM ruby
Hi. Having an issue to get the plugin to start.
[client] Command `bundle list --name-only` failed with exit code 1 (exec options: {"cwd":"/Users/frexuz/www/some-path"})
[client] stderr:
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.4.22) required by your /Users/frexuz/www//Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.4.22`
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/bin/bundle:23:in `<main>'
[client] Failed to invoke Bundler in the current workspace. After resolving the issue, run the command `RuboCop: Start Language Server`
I use rbenv and zsh
and the ruby lsp is starting fine:
I have also tried setting it directly
Not sure which settings im missing 🤔
The RuboCop 1.53.0 or higher required by vscode-rubocop needs Ruby 2.7 or higher: https://github.com/rubocop/vscode-rubocop?tab=readme-ov-file#requirements
It may not be the essential issue, but looking at the log, Ruby 2.6 is being used:
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb
So it seems necessary to first ensure that Ruby 2.7 or higher is selected as the runtime: https://docs.rubocop.org/rubocop/1.58/compatibility.html#support-matrix
But it should be loading ruby from my rbenv installation, not system ruby, right?
which ruby
/Users/frexuz/.rbenv/shims/ruby
Same issue here, can't get this extension to use rvm Ruby
Same issue here.. my workaround is: set the path to the rbenv installed rubocop binary and then say that you run rubocop globally and not with bundler: