我用 Ruby 2.0 创建了 Rails 4 项目。如何临时将 Ruby 的版本更改为 1.9.3。
我试图在 Gemfile 中添加一行:
ruby "1.9.3"
但是当我运行 rake 任务时,它显示:
/home/askar/.rvm/gems/ruby-2.0.0-p195@global/gems/bundler-1.3.5/lib/bundler/definition.rb:361:in `validate_ruby!': Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
from /home/askar/.rvm/gems/ruby-2.0.0-p195@global/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
from /home/askar/.rvm/gems/ruby-2.0.0-p195@global/gems/rubygems-bundler-1.2.0/lib/rubygems-bundler/noexec.rb:73:in `setup'
from /home/askar/.rvm/gems/ruby-2.0.0-p195@global/gems/rubygems-bundler-1.2.0/lib/rubygems-bundler/noexec.rb:85:in `<top (required)>'
from /home/askar/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from /home/askar/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /home/askar/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from /home/askar/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:9:in `<main>'