vscode-rubocop icon indicating copy to clipboard operation
vscode-rubocop copied to clipboard

VSCode trying to find find rubocop in the SYSTEM ruby

Open kg-currenxie opened this issue 2 years ago • 10 comments

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 image image and the ruby lsp is starting fine: image

I have also tried setting it directly image

Not sure which settings im missing 🤔

kg-currenxie avatar Dec 01 '23 12:12 kg-currenxie

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

koic avatar Dec 04 '23 06:12 koic

But it should be loading ruby from my rbenv installation, not system ruby, right?

which ruby
/Users/frexuz/.rbenv/shims/ruby

kg-currenxie avatar Dec 04 '23 06:12 kg-currenxie

Same issue here, can't get this extension to use rvm Ruby

Amnesthesia avatar Jan 12 '24 02:01 Amnesthesia

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:

image

savar avatar Feb 01 '24 08:02 savar