question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ruby version 2.6.1 produces Unknown Ruby version error

See original GitHub issue

My .rubocop.yml file defines a TargetRubyVersion of 2.6, the current version of Ruby set forth in my Gemfile.

On linting, this produces the error:

Error: Unknown Ruby version 2.6 found in `TargetRubyVersion` parameter (in /path/to/my/.rubocop.yml). Known versions: 1.9, 2.0, 2.1, 2.2, 2.3, 2.4

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
benedictfritzcommented, Apr 22, 2020

The issue was that the version of rubocop was too old. We upgraded and the issue went away.

This inspired me to double-check my versioning, and I think something weird happened to me versioning-wise as well that caused this. I think I was unsure whether the vscode plugin was using system rubocop, the rubocop specified by the specific version of ruby I was running via rbenv, and the version of rubocop listed in the bundle.

In the end I got it fixed!

I un-confused myself by specifically telling the vscode plugin to use the Bundler version, and then making sure that Bundler has a more recent version of Rubocop installed that supports Ruby 2.6.

I did the following steps:

  • Go to the vscode settings for the ruby-rubocop plugin (click the little gear on the plugins list)
  • Check the box Ruby > Rubocop: Use Bundler to be explicit that I want to use the version listed in the Gemfile
  • Ran bundle exec rubocop --version in the project directory, which ended up showing a different version from what I was expecting
  • Set an explicit version number in the Gemfile i.e. gem 'rubocop', '~> 0.8'
  • Ran bundle update rubocop in the project directory
  • Ran bundle exec rubocop --version to confirm that the version I expected got installed

Hopefully this helps someone!

0reactions
jacobbeasleycommented, Apr 22, 2020

One note is if you updated rubocop, you may also have to update your config file. Sometimes old features get removed/deprecated/renamed.

Anyways, glad we tracked it down! Hopefully this post helps others.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuboCop found unknown Ruby version 3.1 in `.ruby-version`
I recently upgraded ruby version from 2.7.5 to 3.1.1 and when I try to run rubocop I get error Error: RuboCop found unknown...
Read more >
Strange Rubocop behaviour : r/ruby - Reddit
Error : Unknown Ruby version 2.6 found in `TargetRubyVersion` parameter (in /home/442401/.rubocop.yml). Known versions: 1.9, 2.0, 2.1, 2.2, ...
Read more >
Upgrading Ruby on Rails
This guide provides steps to be followed when you upgrade your applications to a newer version of Ruby on Rails. These steps are...
Read more >
How to Install Ruby on a Mac with chruby, rbenv, or RVM
Using a package management system makes your life easier when installing ... This will install the latest Ruby version on Homebrew (which is ......
Read more >
Install Ruby On Rails on Ubuntu 14.04 Trusty Tahr - GoRails
Next we're going to be installing Ruby using a version manager called Rbenv. ... Installing the libmysqlclient-dev gives you the necessary files to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found