gpt4 book ai didi

ruby-on-rails - 将 Rails 6 应用程序部署到 Elastic Beanstalk 时出现 Bundler 错误

转载 作者:行者123 更新时间:2023-12-05 07:17:30 25 4
gpt4 key购买 nike

在部署到 Heroku 和 AWS Elastic Beanstalk 时,我一直在努力解决众所周知的 bundler 2.0.x 错误。在尝试了许多建议的补救措施后,例如更新 gems 和安装 bundler 2.0.x 或 bundler update --system。到目前为止,这些都没有奏效。我找到了在 .ebextensions 中创建文件的解决方案,如下所示:

files:

# Runs before \./10_bundle_install.sh`:`

"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :

mode: "000775"

owner: root

group: users

content: |

#!/usr/bin/env bash



EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)

EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)

# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: \bundler requires Ruby version >= 2.3.0``

. $EB_SCRIPT_DIR/use-app-ruby.sh



cd $EB_APP_STAGING_DIR

echo "Installing compatible bundler"

gem install bundler -v 2.1.0.pre.2

这是我在 eb deploy staging-1 上仍然遇到的错误:

Creating application version archive "app-7b50-191111_122622".
Uploading: [##################################################] 100% Done...
2019-11-11 17:28:21 INFO Environment update is starting.
2019-11-11 17:28:28 INFO Deploying new version to instance(s).
2019-11-11 17:31:36 ERROR [Instance: i-0ba40e32901557bee] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ystem, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.0.pre.2`
from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-11-11 17:31:36 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-11-11 17:31:36 ERROR Unsuccessful command execution on instance id(s) 'i-0ba40e32901557bee'. Aborting the operation.
2019-11-11 17:31:37 ERROR Failed to deploy application.

ERROR: ServiceError - Failed to deploy application.
[12:31:40] (master) tml_portal
// ♥ eb deploy staging-1
Creating application version archive "app-7b50-191111_123229".
Uploading: [##################################################] 100% Done...
2019-11-11 17:34:45 INFO Environment update is starting.
2019-11-11 17:34:53 INFO Deploying new version to instance(s).
2019-11-11 17:37:47 ERROR [Instance: i-0ba40e32901557bee] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ystem, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.0.pre.2`
from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-11-11 17:37:47 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-11-11 17:37:47 ERROR Unsuccessful command execution on instance id(s) 'i-0ba40e32901557bee'. Aborting the operation.
2019-11-11 17:37:48 ERROR Failed to deploy application.

ERROR: ServiceError - Failed to deploy application.

关于如何解决这个可怕的 Bundler 部署问题有什么想法吗?

最佳答案

它仍然是缺少包版本错误。您可以尝试以下操作吗:

#.ebextensions/bundler_update.config

commands:
update_bundler:
command: /opt/rubies/ruby-2.6.5/bin/gem install bundler -v 2.1.0.pre.2

Ruby 和 Bundler 版本应与您的相匹配。

关于ruby-on-rails - 将 Rails 6 应用程序部署到 Elastic Beanstalk 时出现 Bundler 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58806266/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com