部署到Heroku时Ruby版本有问题

时间:2014-11-10 15:46:52

标签: ruby-on-rails ruby heroku ruby-on-rails-3.2

我使用的是以下版本的Ruby:ruby-1.9.3-p36。虽然我运行rvm时遇到此错误。

$ rvm list
Warning! PATH is not properly set up, '/Users/user/.rvm/gems/ruby-1.9.3-p362/bin' is not at first place,
     usually this is caused by shell initialization files - check them for 'PATH=...' entries,
     it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
     to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p362'.

rvm rubies

    ruby-1.9.3-p327 [ x86_64 ]
 =* ruby-1.9.3-p362 [ x86_64 ]
    ruby-2.0.0-rc1 [ x86_64 ]

我刚刚部署到Heroku,我收到应用程序错误:

ruby-1.9.3-p550 is not installed.
To install do: 'rvm install ruby-1.9.3-p550'

为什么Heroku试图使用'p550'?

1 个答案:

答案 0 :(得分:1)

Ruby拥有一组有限的可用ruby版本和补丁级别,列在the support pages上。

其中包括MRI ruby-1.9.3-p550但不是p362

您的第一步应该是在本地安装p550

$ rvm install ruby-1.9.3-p550

您可以通过将patchlevel添加到您的Gemfile ruby​​要求中来让bundler警告补丁级别的错配。

ruby '1.9.3', :patchlevel => '550'

当您通过添加.ruby-version文件更改为项目目录时,可以让RVM自动切换到正确的ruby版本:

$ echo ruby-1.9.3-p550 > .ruby-version