Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix warning in Rails

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!

like image 747
Kenyo Kai Avatar asked Sep 06 '25 04:09

Kenyo Kai


2 Answers

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.

like image 78
Spencer Avatar answered Sep 09 '25 03:09

Spencer


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.

like image 36
sebasjimenez10 Avatar answered Sep 09 '25 03:09

sebasjimenez10