Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Failed to run RuboCop command - is it installed? #33

Closed
maia opened this issue Dec 25, 2015 · 38 comments
Closed

Failed to run RuboCop command - is it installed? #33

maia opened this issue Dec 25, 2015 · 38 comments

Comments

@maia
Copy link

maia commented Dec 25, 2015

Issue #31 has not been solved with the release of v3.1.0, the plugin fails to load when running rbenv with ruby 2.2.4 and Rubymine 8.0.2.

Here's the idea.log:

2015-12-25 12:01:49,807 [   1243]   INFO -        #com.intellij.idea.Main - IDE: RubyMine (build #RM-143.1184.20, 08 Dec 2015 00:00) 
2015-12-25 12:01:49,807 [   1243]   INFO -        #com.intellij.idea.Main - OS: Mac OS X (10.11.2, x86_64) 
2015-12-25 12:01:49,807 [   1243]   INFO -        #com.intellij.idea.Main - JRE: 1.8.0_40-release-b105 (JetBrains s.r.o) 
2015-12-25 12:01:49,807 [   1243]   INFO -        #com.intellij.idea.Main - JVM: 25.40-b25 (OpenJDK 64-Bit Server VM) 
…
2015-12-25 12:01:49,927 [   1363]   INFO - .intellij.util.EnvironmentUtil - loading shell env: /bin/bash -l -i -c '/Applications/RubyMine 8.0.2.app/Contents/bin/printenv.py' '/private/var/folders/cz/6spsnlp08xj4fb006s6_6x880000gp/T/intellij-shell-env.0.tmp' 
…
2015-12-25 12:01:59,587 [  11023]   INFO - llij.ide.plugins.PluginManager - Loaded custom plugins: RuboCop (3.1.0) 
…
2015-12-25 12:02:08,353 [  19789]   INFO - ruby.rvm.LocalRvmPathsSettings - RVM installation wasn't detected. 
…
2015-12-25 12:02:16,438 [  27874]   INFO - gement.rbenv.RbenvSdkRefresher - Refreshing sdks 
2015-12-25 12:02:16,439 [  27875]   INFO - gement.rbenv.RbenvSdkRefresher - possible ruby sdk in file:///Users/username/.rbenv/versions/2.2.4 
…
2015-12-25 12:02:40,813 [  52249]   INFO - .ruby.ruby.run.RubyCommandLine - Executing [/Users/username/.rbenv/versions/2.2.4/bin/ruby -x /Users/username/.rbenv/versions/2.2.4/bin/gem environment gempath], working dir =[/Users/username/.rbenv/versions/2.2.4/bin] 
…
2015-12-25 12:02:45,152 [  56588]   INFO - .ruby.ruby.run.RubyCommandLine - Executing [/Users/username/.rbenv/versions/2.2.4/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/username/appname/bin/bundle check], working dir =[/Users/username/appname] 
…
2015-12-25 12:02:52,530 [  63966]  DEBUG - hub.sirlantis.rubymine.rubocop - Executing RuboCop (SDK=/Users/username/.rbenv/versions/2.2.4/bin)rubocop --format json /Users/username/appname/app/models/pagerank.rb 
2015-12-25 12:02:52,532 [  63968]   INFO - .ruby.ruby.run.RubyCommandLine - Executing [rubocop --format json /Users/username/appname/app/models/pagerank.rb], working dir =[/Users/username/appname] 
2015-12-25 12:02:52,549 [  63985]   INFO - figurations.GeneralCommandLine - Cannot run program "rubocop" (in directory "/Users/username/appname"): error=2, No such file or directory 
java.io.IOException: Cannot run program "rubocop" (in directory "/Users/username/appname"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:368)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:354)
    at org.jetbrains.plugins.ruby.ruby.run.RubyCommandLine.createProcess(RubyCommandLine.java:64)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:25)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.parseProcessOutput(RubocopTask.kt:67)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.runViaCommandLine(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.run(RubocopTask.kt:60)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:157)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:24)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.d(ExternalToolPass.java:218)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:44)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:160)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
…
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 39 more
2015-12-25 12:02:52,561 [  63997]   WARN - hub.sirlantis.rubymine.rubocop - Failed to run RuboCop command 
com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "rubocop" (in directory "/Users/username/appname"): error=2, No such file or directory
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:358)
    at org.jetbrains.plugins.ruby.ruby.run.RubyCommandLine.createProcess(RubyCommandLine.java:64)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:25)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.parseProcessOutput(RubocopTask.kt:67)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.runViaCommandLine(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.run(RubocopTask.kt:60)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:157)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:24)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.d(ExternalToolPass.java:218)
…
Caused by: java.io.IOException: Cannot run program "rubocop" (in directory "/Users/username/appname"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:368)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:354)
    ... 37 more
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 39 more
2015-12-25 12:02:52,567 [  64003]  ERROR - hub.sirlantis.rubymine.rubocop - Failed to run RuboCop command - is it installed? (SDK=/Users/username/.rbenv/versions/2.2.4/bin) 
com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "rubocop" (in directory "/Users/username/appname"): error=2, No such file or directory
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:358)
    at org.jetbrains.plugins.ruby.ruby.run.RubyCommandLine.createProcess(RubyCommandLine.java:64)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:25)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.parseProcessOutput(RubocopTask.kt:67)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.runViaCommandLine(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.run(RubocopTask.kt:60)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:157)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:24)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.d(ExternalToolPass.java:218)
…
Caused by: java.io.IOException: Cannot run program "rubocop" (in directory "/Users/username/appname"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:368)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:354)
    ... 37 more
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 39 more
@pjar
Copy link

pjar commented Dec 29, 2015

Same here with rvm v1.26.11 ruby v2.2.2p95, RuboCop plugin v3.1.0, RubyMine v8.0.3 and gem rubocop v0.34.2.

idea.log:
http://pastebin.com/txnRuezq

Rubocop runs from console without a problem.

@maia
Copy link
Author

maia commented Jan 6, 2016

@sirlantis Is there any news regarding the issue you could share? Thanks!

@cayblood
Copy link

cayblood commented Jan 6, 2016

👍

@sebastianhegge
Copy link

same problem here, runs on console and sublime without errors, following settings:
rvm 1.26.11
ruby 2.1.5
RuboCop plugin v3.1.0
RubyMine v8.0.3
rubocop gem 0.35.1

@GuilhermeBento
Copy link

same problem here, runs on console and sublime without errors

@danieldekay
Copy link

It might be a configuration issue with RubyMine.
Are you using RVM?
Which shell have you set in RubyMine? Which shell are you using in terminal? Maybe it's a PATH issue?

@sleeptillseven
Copy link

For now, you can manually downgrade to version 3.0.1!

@danieldekay
Copy link

Unfortunately 3.0.1 doesn't work for me either.

Failed to run RuboCop command - is it (or bundler) installed? (SDK=/Users/dekay/.rvm/rubies/ruby-2.1.3/bin): Cannot run program "rubocop" (in dire

rubocop runs fine in Terminal.

@maia
Copy link
Author

maia commented Jan 17, 2016

@sleeptillseven I also had the problem with version 3.0.2 (see #31), I wonder if 3.0.1 will solve the issue. Oh, and as you've been asking about my configuration, that's also mentioned in #31.

@sebastianhegge
Copy link

I forgot to mention that i'm using mac os x yosemite 10.10.5 with the default bash terminal.
rubocop is locatet at:
/Users/myusername/.rvm/gems/ruby-2.1.5/bin/rubocop
but rubymine plugin is searching at:
/Users/myusername/.rvm/rubies/ruby-2.1.5/bin

i placed an symlink (which is also working) there - but plugin still doesn't work.
i'm using the default gemset.

maybe this helps?

@maia
Copy link
Author

maia commented Jan 17, 2016

I'm using OSX 10.11.2, default bash.

> locate "bin/rubocop"
/Users/.../.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bin/rubocop
/Users/.../.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bundler/gems/rubocop-bfc463a5c6aa/bin/rubocop
/Users/.../.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bundler/gems/rubocop-c30ed61f88df/bin/rubocop
/Users/.../.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bundler/gems/rubocop-ec28c40e9adc/bin/rubocop
/Users/.../.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/bin/rubocop`

RubyMine is searching in the wrong directory, in the directory of my app.

Failed to run RuboCop command - is it installed? (SDK=/Users/.../.rbenv/versions/2.2.4/bin): Cannot run program "rubocop" (in directory "/Users/.../directory_of_app"): error=2, No such file or directory

@sleeptillseven
Copy link

I don't know whether this helps but I also installed rubocop global (for that version) as well as through the gemfile (running on a mac with rvm). But as said, a downgrade worked for me. But why I can't explain - software 😨

@GonchuB
Copy link

GonchuB commented Jan 25, 2016

Same thing here

12:27:42 ProcessNotCreatedException: Failed to run RuboCop command - is it installed? (SDK=/Users/.../.rbenv/versions/2.1.4/bin): Cannot run program "rubocop" (in directory "/Users/.../app_directory"): error=2, No such file or directory

But rubocop exists in the SDK directory:

> ls /Users/.../.rbenv/versions/2.1.4/bin/rubocop
/Users/.../.rbenv/versions/2.1.4/bin/rubocop

@maia
Copy link
Author

maia commented Jan 25, 2016

@sirlantis Is there any news regarding the issue you could share? The issue has been nagging us for five weeks now. Thanks a lot!

@maia
Copy link
Author

maia commented Jan 26, 2016

As sirlantis is actively working on other projects and not offline completely, I'm fearing he has chosen to no longer maintain this repo. Is anyone able to fork the repo and provide a solution?

@elskwid
Copy link

elskwid commented Jan 26, 2016

@maia I have a workaround that got me up and running for the time being. I mentioned it here.

@maia
Copy link
Author

maia commented Jan 26, 2016

@elskwid Thanks. As I'm not familiar with how to launch OSX apps from the command line, how did you get mine to find the application? I end up with:

$ GEM_PATH="~/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0:$GEM_PATH" bundle exec mine
[Errno 2] No such file or directory: '/Users/username/Library/Preferences/RubyMine31/port'
The file /Applications/RubyMine 3.1.1.app does not exist.

And yes, I've not been running RubyMine 3.1.1 for years. :)

@elskwid
Copy link

elskwid commented Jan 26, 2016

@maia I'm running RubyMine 8.0.3 - there's a menu item Tools -> Create Command-line Launcher that created the mine exec for me.

@tleish
Copy link

tleish commented Jan 30, 2016

+1 for failure on RubyMine 8.0.3 and rvm

ProcessNotCreatedException: Failed to run RuboCop command - is it installed? (SDK=/Users/username/.rvm/rubies/ruby-2.1.5/bin): Cannot run program "rubocop" (in directory "/Users/username/project"): error=2, No such file or directory

$ which ruby
/Users/username/.rvm/rubies/ruby-2.1.5/bin/ruby

$ which rubocop
/Users/username/.rvm/gems/ruby-2.1.5/bin/rubocop

@jhelmers-fyber
Copy link

Ignores rvm gemsets not finding the rubocop binary in the global space.

@beder
Copy link

beder commented Feb 9, 2016

thanks @elskwid. bundle exec mine did the trick for me.

@tleish
Copy link

tleish commented Feb 9, 2016

  1. Removed and re-created /usr/local/bin/mine executable from Rubymine.
  2. Closed Rubymine
  3. Re-opened Rubymine from project with gem 'rubocop' in Gemfile using bundle exec mine .

Unfortunately I still get the Failed to run RuboCop command... error .

@r-glebov
Copy link

Still can't get how to use "bundle exec mine". Please someone explain it in simple way.

@elskwid
Copy link

elskwid commented Feb 17, 2016

@tleish and @grbro - I fully recognize that what I'm doing is a huge hack so please take this as just my way of getting around the issue.

There's more to it than just bundle exec mine. I had to do the following:

GEM_PATH="/path/to/bundled/gems/ruby/2.3.0:$GEM_PATH" bundle exec mine

Notice that I'm appending the path to the bundled gems to the GEM_PATH since that's what RubyMine is using to find RuboCop.

In fact, I actually install my gems with bundler to a non-standard path (bundle install --path .bundle) and I do so without RVM or anything else. So, the default RM gem + bundler detection was failing. Hence my fix above.

@r-glebov
Copy link

Big thanks @elskwid ! Now it works :)

@Clete2
Copy link

Clete2 commented Feb 27, 2016

Same issue here, but @elskwid's fix did not work for me.

I uninstalled all rubies using rvm except the one that I am using (2.2.3).

cletelaptop:thirtyone clete2$ which rubocop /Users/clete2/.rvm/gems/ruby-2.2.3/bin/rubocop

Log:
9:28:51 AM ProcessNotCreatedException: Failed to run RuboCop command - is it installed? (SDK=/Users/clete2/.rvm/rubies/ruby-2.2.3/bin): Cannot run program "rubocop" (in directory "/Users/clete2/Documents/workspace/ruby/thirtyone/thirtyone"): error=2, No such file or directory

@fermion
Copy link

fermion commented Mar 10, 2016

@maia, the README here is pretty clear 😄 :

I'm not working on this project. This is more of a proof-of-concept and works for me(tm).

That being said the frustration is legit. I was able to fix this by switching to the right version of Ruby (using rbenv) and running:

  1. gem install rbenv
  2. rbenv rehash
  3. restart RubyMine

It's working for me now. Hope this helps!

@chenwardT
Copy link

chenwardT commented Mar 28, 2016

If you're having this issue on OSX, one fix may be opening it from a terminal:

open -a Rubymine

...or the equivalent as was pointed out elsewhere:

mine

I believe this gives it access to your PATH, which was part of things that were removed from apps launched from the dock w/a recent update to OSX.

@pkang
Copy link

pkang commented Apr 4, 2016

@chenwardT's solution worked for me. Thanks!

@hyjk2000
Copy link

hyjk2000 commented Apr 26, 2016

@chenwardT 's solution worked for me too. Actually using RubyMine's command line launcher mine has same effect. I believe the cause is when RubyMine is launched from terminal, ~/.rbenv/shims is included in PATH.

In my case, this issue only happens when rubocop is in Gemfile. If rubocop is not bundled, it works smoothly no matter how I launch RubyMine.

I'm using rbenv and RubyMine 2016.1.

Update: Here's an unofficial build with #39 which works for me.

@BalGuldur
Copy link

Big thnx @elskwid work for me bundle exec mine in work project without GEM_PATH.
i have .ruby-gemset .ruby-version
cd /path_to_project
bundle exec mine

@khadzhinov
Copy link

@chenwardT's solution worked for me

@stacybird
Copy link

Thank you @chenwardT I figured it with either a osx update or the selective osx case sensitivity at work.

@maia
Copy link
Author

maia commented Jul 15, 2016

While I still can't get this version to work (running OSX and rbenv, launching RubyMine from the command line), the fork by johnthagen of this repo fixed the problem for me.

@BastienL
Copy link

@chenwardT's solution made the trick for me too

@andrewtch
Copy link

Bug is still present (

@stjimmy88
Copy link

solution from @chenwardT works perfectly and nothing else works still... is this rubocop plugin discontinued now or something? looks like it has been more than a year and same bug still exists

@tackeyy
Copy link

tackeyy commented Jun 23, 2017

It works for me too. Thanks @chenwardT .

#33 (comment)

OSX Yosemite 10.10.5

RubyMine 2017.1.4
Build #RM-171.4694.21, built on June 2, 2017

@maia maia closed this as completed Mar 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests