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

Could not find 'rubocop'. The program may not be installed. #548

Closed
reidcooper opened this issue Sep 14, 2015 · 20 comments
Closed

Could not find 'rubocop'. The program may not be installed. #548

reidcooper opened this issue Sep 14, 2015 · 20 comments
Assignees
Labels
Milestone

Comments

@reidcooper
Copy link

I have install rubocop as for my linter and auto-beautify via atom-beautify in settings. However, when I run the command, "ctrl-alt-b", it returns the error that it cannot find 'rubocop'.

But linter-rubocop can find rubocop fine and work properly. I have it under rbenv.

Link:
https://gist.github.com/reidcooper/1cc6d16bf06cc8686d0c

@Glavin001
Copy link
Owner

Please follow contribution guides at https://github.com/Glavin001/atom-beautify/blob/master/CONTRIBUTING.md
Specifically the Gist named debug.md with the results of the Atom Beautify: Help Debug Editor.

@Glavin001 Glavin001 self-assigned this Sep 14, 2015
@reidcooper
Copy link
Author

I updated my original post.

@Glavin001
Copy link
Owner

Thanks,, I'll take a look.

For reference, here is the applicable code in linter-rubocop: https://github.com/AtomLinter/linter-rubocop/blob/master/index.coffee

@Glavin001
Copy link
Owner

@reidcooper Atom Beatify uses your PATH environment variable to detect the location of executables.

This is what Atom Beautify detects your PATH environment variable to be:

PATH=/Users/reidcooper/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin

Could you confirm this by going into your Terminal and running echo $PATH?

Also what is the path to your rubocop executable? Running which rubocop will return this in your Terminal.

@reidcooper
Copy link
Author

echo $PATH

/Users/reidcooper/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin

which rubocop

rubocop not found

If I type:

rbenv which rubocop

then I get:

/Users/reidcooper/.rbenv/versions/2.2.2/bin/rubocop

@reidcooper
Copy link
Author

I am using linter-rubocop and according to their documentation, it said, if you are using rbenv to type in:

rbenv which rubocop

Link:
https://atom.io/packages/linter-rubocop

@Glavin001
Copy link
Owner

So you have manually set the executablePath for linter-rubocop then? If yes, then this indicates that your statement:

But linter-rubocop can find rubocop fine and work properly.
was incorrect. linter-rubocop was not able to find rubocop and instead you manually set it.

You can get Atom Beautify to work by adding /Users/reidcooper/.rbenv/versions/2.2.2/bin/ to your PATH environment variable.

@reidcooper
Copy link
Author

I executed

export PATH=$PATH:/Users/reidcooper/.rbenv/versions/2.2.2/bin

to add to my path, and I restarted Atom. However, I still received the same error. Am I forgetting something? Also, I am using z-shell if that matters.

Edit: I think I got it to work. I had to add to my zshell profile instead of the bash profile.

@Glavin001
Copy link
Owner

Edit: I think I got it to work. I had to add to my zshell profile instead of the bash profile.

Right on. Glad to here it is working now.

I hope to make this process easier in the future.

@Glavin001 Glavin001 added this to the v0.29.0 milestone Sep 14, 2015
@geoffreysteven
Copy link

I have also been working on this problem. Just fixed it - the gem is missing:

gem install rubocop

Solved it by looking at linter-rubocop.
Might I suggest adding this to the documentation. I didn't realize there was a linter for ruby.
https://www.ruby-toolbox.com/projects/rubocop

@emanuelet
Copy link
Contributor

I'm still experiencing this issue even after having tried the solutions listed above. Would it be possible to add an option at the end to specify the path of Rubocop?

@Glavin001
Copy link
Owner

@emanuelet : I would accept a Pull Request. Applicable code can be found at https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/rubocop.coffee

@emanuelet
Copy link
Contributor

opened PR #676

@aashish
Copy link

aashish commented Jan 17, 2017

update settings as in following:

settings

@Glavin001
Copy link
Owner

I really want to focus on improving the installation experience for users. I have created a new Issue, #1687, to target this problem. Please provide your feedback! Thanks in advance.

@goxr3plus
Copy link

@aashish Image is missing ...

@aashish
Copy link

aashish commented Dec 25, 2017

@goxr3plus Sorry for that. Please follow the instructions

$ which rubocop
/home/xxxxxx/.rvm/gems/ruby-2.3.1@xxxxxxxx/bin/rubocop

Update Rubocop Path as
/home/xxxxxx/.rvm/gems/ruby-2.3.1@xxxxxxxx/bin/rubocop

@goxr3plus
Copy link

goxr3plus commented Dec 25, 2017 via email

@aashish
Copy link

aashish commented Dec 25, 2017

@goxr3plus great!! robocop is being detected.

@stramec
Copy link

stramec commented Apr 18, 2018

For anyone that the above doesn't work for. If you have installed the gem and still getting errors, try using the RVM wrappers, solved it for me.

/Users/xxxxx/.rvm/gems/ruby-2.3.7@xxxxx/wrappers/rubocop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants