简体   繁体   中英

How to switch to truffleruby on Rails?

I'd like to try running Rails 6 with TruffleRuby, so I installed truffleruby-22.0.0.2 with rbenv, added in my Gemfile ruby 'truffleruby-22.0.0.2 and ran bundle install , but that didn't work. I got an error with "... error parsing Gemfile: Illformed requirement..."

What's the right way to use Rails with TruffleRuby?

If this is still relevant: you can see here https://github.com/oracle/truffleruby/blob/master/doc/user/compatibility.md that as of now Truffle Ruby aims to be compatible with MRI Ruby 3.0.3, so it sets the RUBY_VERSION env variable to 3.0.3 and this is the value you should set in your Gemfile.

Unfortunately, when you do so rbenv can't detect that you want to use Truffle Ruby instead of MRI. So you should also run export RBENV_VERSION=truffleruby+graalvm-dev and then bundler would target to 3.0.3 while rbenv would use Truffle Ruby.

To know what is the target version detected by bundler you can specify any valid ruby version (like 3.1.2 or something) and running bundle would output more clarifying error message like this:

Your Ruby version is 3.0.3, but your Gemfile specified 3.1.2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM