rbenv: rubocop: command not found - but it is installed...

I'm a bit flummoxed. I'm using rbenv and have run `gem install rubocop` using the rbenv ruby version that I'm using with rubymine. Furthermore, under Languages & Frameworks > Ruby SDK and Gems the rbenv SDK I have selected shows that rubocop is installed.

Based on this I assume it rubocop it should be working, but instead I get this error:

Error:Rubocop returned exit code: 127
rbenv: rubocop: command not found

I have no issues running `rubocop` in the terminal however, and I haven't been able to coax a more detailed error message out of Rubymine. I'm guessing there's some PATH configuration I need to do, or some other config to adjust how Rubymine is calling rubocop, but I'm stuck at this point.

Open to any suggestions! Thanks!

Comment actions Permalink

After a bit of sleep and a cup of coffee I fixed the issue. It seems like I hadn't completely scrubbed rvm from my machine before installing rbenv, and my .profile still had some path variables set to the .rvm directory. gem install rubocop was installing to a .rvm directory, which must have caused issues with the way Rubymine invokes rubocop.

Still, it would be great to know the actual path / command RubyMine uses with rubocop, if anyone knows.

EDIT: Through trial and error it looks like RubyMine uses the command rbenv exec rubocop (if you're using rbenv that is).

Comment actions Permalink

That's right, in case of rbenv it uses 

rbenv exec rubocop



Please sign in to leave a comment.