Ruby-Rubocop not working on vscode

smmr14 picture smmr14 · May 18, 2018 · Viewed 7.8k times · Source

/Users/me/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in ``find_spec_for_exe': can't find gem rubocop (>= 0.a) with executable rubocop (Gem::GemNotFoundException) from /Users/me/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in ``activate_bin_path' from /Users/me/.rbenv/versions/2.5.1/bin/rubocop:23:in'

This is the error I keep getting whenever I type something. Does anyone know how to fix this problem?

Answer

clarkesh picture clarkesh · Oct 10, 2019

After many agonising hours and reading other solutions I finally deduce that the answer was in installing Rubocop from the root. Below steps worked when I tried. You first need to go the root in your terminal. Install Rubocop then find the path and add it to the execute path in Rubocop settings

$ cd ~
$ gem install rubocop
$ which rubocop
Paste location given in Ruby-Rubocop configuration settings > Execute Path
/Users/username/.rvm/gems/ruby-2.6.1/bin/