在生产中更新了Ruby,现在Rails无法启动,因为仍然引用旧的红宝石 [英] Updated Ruby in production and now Rails won't start because still referencing old ruby
问题描述
只需通过RVM在登台服务器上更新Ruby:
Just updated Ruby on a staging server via RVM:
$ rvm upgrade 1.9.3-p327 1.9.3-p362
我对所有迁移和别名问题(包括删除旧Ruby)说是。
I said 'yes' to all the migration and alias questions including deleting old Ruby.
现在,每当我尝试访问Rails应用程序时,都会从旅客中获取错误:
Now getting error from Passenger whenever I try to access Rails application:
Error message:
dlopen(/Library/WebServer/rails/myapp/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/lib/bcrypt_ext.bundle, 9):
Library not loaded: /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/libruby.1.9.1.dylib
Referenced from: /Library/WebServer/rails/myapp/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/lib/bcrypt_ext.bundle
Reason: image not found - /Library/WebServer/rails/myapp/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/lib/bcrypt_ext.bundle
我已经重新安装了Passenger ...并且还运行了 cap deploy
,其中的 略有更新。但似乎仍然有一些关于旧Ruby的引用。 这里发生了什么,如何进行更新或重新编译,以便gem等引用新的Ruby?我可以在Capistrano中指定一些标志来强制重新编译gem(假设是问题所在) ?
I've re-installed Passenger...and also ran cap deploy
with slightly updated Gemfile
. but it appears there are still some references to the old Ruby. What's happening here and how can up update, or re-compile, so gems etc reference new Ruby? Is there some flag I can specify in Capistrano that would force the recompiling of gems (assuming that's the problem)?
编辑(添加一些RVM信息):
Edit (adding some RVM info):
我正在使用多用户安装此服务器上 RVM 的位置,并且因为这些宝石安装在: /Library/WebServer/rails/popup/shared/bundle/ruby/1.9.1/gems
而不是我可能期望的位置: /usr/local/rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems
。从来没有真正了解过RVM在多用户安装中正在做什么,但是它确实有效。
I'm using a "Multi-user" installation of RVM on this server and because of that the gems are installed in: /Library/WebServer/rails/popup/shared/bundle/ruby/1.9.1/gems
and not where I might have expected them: /usr/local/rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems
. Never really understood what RVM was doing in a Multi-user installation but it has worked.
因此,看来我不能真正 $ rvm gemset使用myapp
然后捆绑安装
,因为我认为它不会安装在正确的目录中。
So, poing being I can't really $ rvm gemset use myapp
and then bundle install
because I don't think that would install in the correct directory.
此处是 Capistrano 的输出在捆绑安装
任务期间:
Here's Capistrano's output during bundle install
task:
* 2013-01-03 19:23:22 executing `bundle:install'
* executing "cd /Library/WebServer/rails/myapp/releases/20130104032317 && bundle install --gemfile /Library/WebServer/rails/myapp/releases/20130104032317/Gemfile --path /Library/WebServer/rails/myapp/shared/bundle --deployment --quiet --without development test"
推荐答案
该错误大约与 /Library/WebServer/rails/myapp/shared/bundle/ruby/1.9.1/gems/bcrypt有关-ruby-3.0.1 / lib / bcrypt_ext.bundle
引用不存在的文件 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/libruby。 1.9.1.dylib
这应该不发生,因为在大多数情况下 libruby .1.9.1.dylib
应该已经在运行时从ruby加载。因此,要么您仅使用静态编译安装了ruby,要么它可能已损坏。
The error is about /Library/WebServer/rails/myapp/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/lib/bcrypt_ext.bundle
referencing non existing file /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/libruby.1.9.1.dylib
this should not happen as in most cases libruby.1.9.1.dylib
should be available as already loaded from ruby when it's running. So either you have installed ruby using only static compilation or it might be broken.
您确定ruby 1.9.3-p362
被使用? RVM为OSX 10.8提供 1.9.3-p327
,它是静态编译的(OSX上没有软件包管理器问题)。也许您使用的是该版本( p327
)?
Are you sure ruby 1.9.3-p362
is used? RVM provides 1.9.3-p327
for OSX 10.8 which is compiled statically (no package manager issue on OSX). Maybe you used that version(p327
) instead?
关于重新安装gems-尚无命令这将强制在捆绑程序中重新安装已安装的gem,但是您可以只删除gem并强制重新安装:
As for reinstalling the gems - there is not yet a command that would force reinstalling installed gems in bundler, however you can just remove the gems and force installation fresh:
cd /Library/WebServer/rails/myapp/
rm -rf shared/bundle
bundle install
这篇关于在生产中更新了Ruby,现在Rails无法启动,因为仍然引用旧的红宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!