Reputation: 71
I'm newbie in Rails. I did something and this warning appear:
warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.3-compliant syntax, but you are running 2.2.1.
warning:please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Can anyone help me explain why it appear and how to fix it? Thanks a lot!
Upvotes: 4
Views: 5433
Reputation: 4857
Upgrading ruby to the newest version worked for me.
In my specific case I had
warning: parser/current is loading parser/ruby30, which recognizes warning: 3.0.1-compliant syntax, but you are running 3.0.0. warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
and had to upgrade ruby from 3.0.0 to 3.0.1
Upvotes: 0
Reputation: 81558
If you're using RuboCop, you may want to add require: false
after the gem 'rubocop'
statement in your Gemfile
, so that you only load RuboCop when you use it.
Upvotes: 0
Reputation: 79
I was seeing this not only for rubocop but also for rspec and so. Fixed it by updating the parser gem with bundler. Didn't really specify a gem version. Just the latest one.
Upvotes: 1
Reputation: 1496
I got this error because I had the rubocop gem in my project which requires parser. I fixed it by locking my parser gem to the current ruby version we use.
For us, we use ruby 2.2.2, so I added gem 'parser', '~> 2.2.2.5'
to my test group.
Since rubocop 0.24, he has used parser v2.2.x which means we we need to use ruby >= 2.2.2 to avoid that warning. Though the gem only requires ruby 1.9.3, so you can still use it but you're going to get warnings.
Upvotes: 6