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

VSCode trying to find find rubocop in the SYSTEM ruby #21

Open
kg-currenxie opened this issue Dec 1, 2023 · 5 comments
Open

VSCode trying to find find rubocop in the SYSTEM ruby #21

kg-currenxie opened this issue Dec 1, 2023 · 5 comments

Comments

@kg-currenxie
Copy link

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 🤔

@koic
Copy link
Member

koic commented Dec 4, 2023

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

@kg-currenxie
Copy link
Author

kg-currenxie commented Dec 4, 2023

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

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

@Amnesthesia
Copy link

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

@savar
Copy link

savar commented Feb 1, 2024

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

@davletovalmir
Copy link

We're using chruby and ruby-install, no luck launching it, same issue: it's trying to use Ruby of version 2.6, though we're on version 3.0.7. @savar's solution didn't help, though I tried it before discovering this thread 😞

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

5 participants