简体   繁体   English

Rails 3,Bundler和RVM在生产中找不到新的宝石

[英]New Gems Not Found in Production with Rails 3, Bundler and RVM

I recently set up a production server for a Rails 3 app. 我最近为Rails 3应用设置了生产服务器。

On the initial deploy everything worked fine. 在最初的部署中,一切正常。 On a subsequent deploy, new gems that were added to the project are not being found. 在随后的部署中,找不到添加到项目中的新gem。 I am getting uninitialized constant and undefined method errors when I reference classes and methods from the newly added gems, respectively. 当我分别从新添加的gem中引用类和方法时,出现uninitialized constantundefined method错误。

When I originally set things up I was using a gemset with RVM, but have tried to simplify things by removing the gemset and only using RVM to manage rubies. 当我最初进行设置时,我使用的是带有RVM的gemset,但是试图通过删除gemset并仅使用RVM来管理红宝石来简化事情。

When I run bundle list every thing is there. 当我运行bundle list所有东西都在那里。 All of the gem are in <app_root>/shared/bundle/ruby/1.9.1/gems/ 所有的宝石都在<app_root>/shared/bundle/ruby/1.9.1/gems/

It seems like maybe it's loading the gems from some other location, like the original gemset, but I have deleted it. 似乎它是从其他位置加载宝石,例如原始宝石集,但我已将其删除。

Some other details, I am using Capistrano, of course, Unicorn, my GEM_HOME=/home/deployer/.rvm/gems/ruby-1.9.3-p286 其他一些细节,我正在使用Capistrano,当然是独角兽,我的GEM_HOME=/home/deployer/.rvm/gems/ruby-1.9.3-p286

Let me know if there is any other info I can provide. 让我知道是否可以提供其他信息。

Thanks. 谢谢。

if you use bundle install --deployment then you also have to prefix commands with bundle exec when you execute the command, like: 如果使用bundle install --deployment则在执行命令时还必须在命令前加上bundle exec ,例如:

bundle exec rake db:migrate

If you use bundler/capistrano integration then it does it for you in capistano but in console you need to use bundle exec manually. 如果您使用bundler/capistrano集成,那么它会在capistano为您完成,但是在控制台中,您需要手动使用bundle exec

RVM was helping you to avoid it with rubygems-bundler gem - but you changed gemset so the generated wrappers are no more available. RVM可以帮助您避免使用rubygems-bundler gem-但是您更改了gemset,因此不再提供生成的包装器。 You would have to clean <app_root>/shared/bundle/ruby/1.9.1/gems/ and run bundle install again to regenerate the wrappers to avoid typing bundle exec again. 您将必须清理<app_root>/shared/bundle/ruby/1.9.1/gems/并再次运行bundle install以重新生成包装程序,以避免再次键入bundle exec

I have similar problems. 我有类似的问题。 It turns out Capistrano isn't properly restarting unicorn. 事实证明,Capistrano无法正确重启独角兽。 SSHing into the server and stopping then starting unicorn did the job. SSH进入服务器,然后停止然后启动独角兽就完成了这项工作。 Now to find a fix for Capistrano's shenanigans... 现在找到Capistrano的恶作剧的修复方法...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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