Linter Issue: Rubocop command [SOLVED]

Hi, when I first applied, I followed used appAcademy’s dotfiles to setup my mac environment: https://github.com/appacademy/dotfiles. I believe when I first started applying, I installed the latest version of Ruby or some version higher than 2.5.0. I wasn’t getting any errors from Linter about RuboCop.

I’m currently doing the alpha course prepwork and when I went to open the first exercise, I received this and another error (my git workspace wasn’t set up?). It looks like rubocop only works for Ruby 2.5.0 or maybe all versions higher than 2.5.0?

Has anyone run into this and if so, provide some feedback? I’m a little confused about rbenv. I know it’s used to keep track of ruby versions and gem bundles for different applications we’re building. However, I am confused as to how to get rubocop set up for 2.3.1 (the version used in alpha course) since it’s technically an atom add-on(?).

Thanks!
Ryan

/Users/ryan/.atom/packages/linter/lib/linter-registry.js:159 [Linter] Error running RuboCop Error: rbenv: rubocop: command not found

The `rubocop’ command exists in these Ruby versions:
** 2.5.0**
at ChildProcess. (/Users/ryan/.atom/packages/linter-rubocop/node_modules/sb-exec/lib/index.js:56:20)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:554:12) <

[SOLVED] I originally installed ruby 2.5.0 using rbenv. When I started the alpha prepwork, they had me install 2.3.1 and set my global ruby version to 2.3.1. I checked the gems installed for both 2.5.0 and 2.3.1 to see what the difference was and all that was causing the error was that 2.3.1 did not have rubocop (or any of its dependencies) installed. Because of this, I was receiving visually intrusive errors while using atom (multiple error messages popping up and blocking the text file).

If you’re running into this error -

  1. type ‘gem environment’ into the terminal and look at the ‘GEM PATHS’ section.

    • if you have rbenv installed your path should look like:

    /Users/<your_username>/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0

  2. navigate to that destination :

    cd /Users/<your_username>/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0

  3. then type ls to see what folders are inside, looks like there is another folder called ‘gems’

    cd gems
    ls

    • you probably won’t see rubocop (or other gem names if you’re running into the command not
      found error but for a different gem name)
  4. if so, just type:
    > gem install

    • your error should go away
1 Like