Ruby version 2.6.1 produces Unknown Ruby version error
See original GitHub issueMy .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:
- Created 4 years ago
- Comments:7
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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:
ruby-rubocop
plugin (click the little gear on the plugins list)Ruby > Rubocop: Use Bundler
to be explicit that I want to use the version listed in theGemfile
bundle exec rubocop --version
in the project directory, which ended up showing a different version from what I was expectinggem 'rubocop', '~> 0.8'
bundle update rubocop
in the project directorybundle exec rubocop --version
to confirm that the version I expected got installedHopefully this helps someone!
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.