简体   繁体   English

如何定义正确的 Bundler 版本? (Capistrano 部署问题)

[英]How to define the correct Bundler version? (Capistrano deployment problem)

I'm currently trying to deploy my Rails application with Capistrano.我目前正在尝试使用 Capistrano 部署我的 Rails 应用程序。 I don't get any errors when I cap deploy but when I open the browser I see: "Your Gemfile.lock was generated by Bundler 0.10. You must delete it if you wish to use Bundler 0.9. (Bundler::GemfileError)"我在cap deploy时没有收到任何错误,但是当我打开浏览器时,我看到:“您的 Gemfile.lock 是由 Bundler 0.10 生成的。如果您想使用 Bundler 0.9,则必须删除它。(Bundler::GemfileError)”

I installed bundler on both machines, my local machine and the production box.我在两台机器上安装了 bundler,我的本地机器和生产机器。 I assume the latter uses a system wide gem that is of a different version.我假设后者使用不同版本的系统范围的 gem。 How do I define which version is the right one?我如何定义哪个版本是正确的?

Some background:一些背景:

Apache/Passenger, Rails 3.0.3, Capistrano 2.6.0, Bundler 1.0.15. Apache/Passenger、Rails 3.0.3、Capistrano 2.6.0、Bundler 1.0.15。 The binary of the manually installed gem is found in /var/www/htdocs/web18/.gems/bin/bundle .手动安装的 gem 的二进制文件位于/var/www/htdocs/web18/.gems/bin/bundle I also added the following lines to my config/deploy.rb :我还在我的config/deploy.rb中添加了以下几行:

set :default_environment, {
  'GEM_HOME'    => '/var/www/htdocs/web18/.gems',
  'GEM_PATH'    => '/var/www/htdocs/web18/.gems',
  'BUNDLE_PATH' => '/var/www/htdocs/web18/.gems'
}

set :bundle_cmd, '/var/www/htdocs/web18/.gems/bin/bundle'

After deployment I see all Gems in /var/www/htdocs/web18/.gems/gems/部署后,我在/var/www/htdocs/web18/.gems/gems/中看到所有 Gems

Any help is much appreciated任何帮助深表感谢

Consider deleting the Gemfile.lock and running bundle again to see if this works.考虑删除Gemfile.lock并再次运行bundle以查看是否可行。 Also, you should try to use RVM as well as being able to setup gemsets is a life saver at times like these.此外,您应该尝试使用 RVM 以及能够设置 gemset 在这种情况下可以挽救生命。

If the above doesn't work do gem list and uninstall the older version of bundler if you find more than one on your system.如果上述方法不起作用,请执行gem list并卸载旧版本的捆绑器,如果您在系统上发现多个捆绑器。

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

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