简体   繁体   English

推送到Elastic Beanstalk时Rails捆绑错误

[英]Rails bundle error when pushing to Elastic Beanstalk

I had an app deployed on Heroku and I am currently trying to create the same app on AWS. 我在Heroku上部署了一个应用程序,我目前正在尝试在AWS上创建相同的应用程序。 I've copied my folder, created a complete separated repo on Github and installed ebcli, the setup looks fine. 我已经复制了我的文件夹,在Github上创建了一个完整的独立仓库并安装了ebcli,设置看起来很好。

When I try to run eb deploy, I have this error: [Instance: i-03051e2a022886184] Command failed on instance. 当我尝试运行eb deploy时,出现此错误:[Instance:i-03051e2a022886184]命令在实例上失败。 Return code: 1 Output: (TRUNCATED)...:in find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) from /opt/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:in activate_bin_path' from /opt/rubies/ruby-2.5.3/bin/bundle:23:in `'. 返回码:1输出:(TRUNCATED)...:在find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) from /opt/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:in :来自/opt/rubies/ruby-2.5.3/bin/bundle:23:in`'的activate_bin_path'。

I've looked online and it says it comes from incompatibility between your gemlock file bundler version and actual bundler version. 我在网上看过,它说它来自你的gemlock文件捆绑版本和实际的捆绑版本之间不兼容。

I've tried to change my bundler version to this one, but I gave up and came back to 2.0.1 because I had to install too many dependencies otherwise. 我试图将我的Bundler版本更改为此版本,但我放弃并回到2.0.1,因为我必须安装太多的依赖项。 I removed the gemlock, bundle again, but I still got the same error when trying to deploy. 我再次移除了gemlock,但是在尝试部署时我仍然遇到了同样的错误。

With my heroku version, it always worked. 使用我的heroku版本,它始终有效。

Any idea how to solve that? 知道如何解决这个问题吗?

Thanks a lot 非常感谢

We moved from Heroku to AWS a few months back as well and it will likely take some some custom scripting to get things to work. 几个月前我们从Heroku迁移到AWS,它可能需要一些自定义脚本才能让事情发挥作用。

It would help to know more about your EB environment, but I am assuming you are using Ruby 2.5 with Puma on Amazon Linux 2.9.0 (?) 这将有助于更多地了解您的EB环境,但我假设您在Amazon Linux 2.9.0上使用Ruby 2.5和Puma(?)

Not sure what bundle version comes with that, But I don't think it's 2.x. 不确定捆绑版本带有什么,但我不认为它是2.x. so you have to add an .ebextensions file too install your preferred bundled version. 所以你必须添加一个.ebextensions文件,也可以安装你喜欢的捆绑版本。

# .ebextensions/01_install_bundler.config

container_commands:
  install_bundler:
    command: “gem install bundler —-version 2.0.0”

More info on AWS Linux customizations 有关AWS Linux自定义的更多信息

End of the day, we are much happier with our AWS environment (lower cost, better performance), but requires more work to get it set up 在一天结束时,我们对AWS环境更加满意(成本更低,性能更好),但需要更多工作才能完成设置

Actually the problem exists because the bundler version in the eb env is older than the one being used in the project source. 实际上存在问题是因为eb env中的bundler版本比项目源中使用的版本旧。

So the solution is to use a bundler version less or equal the eb env installed version. 所以解决方案是使用小于或等于eb env安装版本的bundler版本。

First uninstalled the current bundler: 首先卸载当前的捆绑包:

gem uninstall bundle gem卸载包

and then install the desired one: 然后安装所需的一个:

gem install bundler -v 1.16.6 gem install bundler -v 1.16.6

See more details 查看更多详情

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

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