首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将Rails 6 App部署到Elastic Beanstalk时出现捆绑器错误

将Rails 6 App部署到Elastic Beanstalk时出现捆绑器错误
EN

Stack Overflow用户
提问于 2019-11-12 01:47:49
回答 1查看 458关注 0票数 3

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

代码语言:javascript
复制
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上仍然得到的错误

代码语言:javascript
复制
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.

对于如何解决这个可怕的捆绑问题进行部署,您有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2020-02-12 08:02:09

它仍然是缺少捆绑包版本的错误。你能试试下面的内容吗:

代码语言:javascript
复制
#.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版本应该与您的一致。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58806266

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档