【问题标题】:ec2 instance "Could not locate Gemfile or .bundle/ directory"ec2 实例“找不到 Gemfile 或 .bundle/ 目录”
【发布时间】:2019-01-04 05:36:39
【问题描述】:

我在 Elastic Beanstalk 上上传和部署 ruby​​ 应用程序时遇到问题

在“/var/log/eb-activity.log”中有一个错误“/opt/rubies/ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler.rb:221:in `rescue in root': 找不到 Gemfile 或 .bundle/ 目录 (Bundler::GemfileNotFound)'。



这是来自 ec2 实例的 bundler.rb 第 221 行的部分代码

  def root
  @root ||= begin
              default_gemfile.dirname.expand_path
            rescue GemfileNotFound
              bundle_dir = default_bundle_dir
              raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
              Pathname.new(File.expand_path("..", bundle_dir))
            end
   end

这个网站有完整的 bundler.rb 代码,和我的 bundler.rb 完全一样

http://sistework.mspbs.gov.py/redmin/GEM_HOME/gems/bundler-1.10.6/lib/bundler.rb

这是 GemFile 的图像



顺便说一句,通常我在压缩应用程序并上传之前运行此命令

bundle package

从此链接
https://aws.amazon.com/blogs/devops/locally-packaging-gem-dependencies-for-ruby-applications-in-elastic-beanstalk/

【问题讨论】:

  • 您说...'我怀疑发生此错误是因为应用程序包中缺少 Gemfile'...这是否意味着您的应用没有 Gemfile?
  • @AlejandroMarti 放弃了我在谈论 puma 应用程序的句子,但我用 gemFile 中的图像更新了问题

标签: ruby-on-rails ruby amazon-ec2 rubygems amazon-elastic-beanstalk


【解决方案1】:

通常有两件事可以为我解决这个问题。

  1. 我没有捆绑安装。
  2. 有时,我必须使用 bundle exec 运行一些东西

bundle exec <Your path> puma

【讨论】:

  • 我可以毫无问题地运行这些命令,通常我运行 bundle install 然后 bundle package 然后我压缩文件并上传并部署到 Elastic Beanstalk。之后,我将在 eb-activity.log 中收到错误消息,即“在 root 中救援”:找不到 Gemfile 或 .bundle/ 目录(Bundler::GemfileNotFound)”。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-03-17
  • 1970-01-01
  • 1970-01-01
  • 2015-11-09
  • 1970-01-01
  • 2020-08-25
  • 1970-01-01
相关资源
最近更新 更多