Older version of Ruby Parser Error

rails
ruby

#1

I’m trying to use an older version of Ruby but I keep getting a parser compatibility error

App 36588 stderr: warning: parser/current is loading parser/ruby22, which recognizes
App 36588 stderr: warning: 2.2.5-compliant syntax, but you are running 2.2.1.
App 36588 stderr: warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

I managed to fix this by updating my ruby and rails versions but I actually really need to be using the older version as I am contributing to a larger project. Is there a way to fix this without updating?


#2

You can switch to different Ruby versions in your workspace by using RVM (Ruby Version Manager). You can first list the current installed versions that RVM can use:

rvm list

Then you can choose one of those versions by running:

rvm use <version>

If the version you want to use is not installed then install it first, also using RVM:

rvm install <version>

And then switch to that version with the rvm use command.