简体   繁体   English

ec2实例“无法找到Gemfile或.bundle /目录”

[英]ec2 instance “Could not locate Gemfile or .bundle/ directory”

I'm having trouble with uploading and deploying ruby app on Elastic Beanstalk 我在Elastic Beanstalk上上传和部署ruby应用程序时遇到问题

In the '/var/log/eb-activity.log' there was an error '/opt/rubies/ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler.rb:221:in `rescue in root': Could not locate Gemfile or .bundle/ directory (Bundler::GemfileNotFound)'. 在'/var/log/eb-activity.log'中有一个错误'/opt/rubies/ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler.rb:221: root':找不到Gemfile或.bundle /目录(Bundler :: GemfileNotFound)'。

在此处输入图片说明



here is part of the code on line 221 from bundler.rb from the ec2 instance 这是来自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

This website has full code of bundler.rb that is exact similar to my bundler.rb 该网站具有bundler.rb的完整代码,与我的bundler.rb完全相似

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

Here is an image of GemFile 这是GemFile的图像 在此处输入图片说明



by the way usually I run this command before i zip the app and upload it 顺便说一句,通常我在压缩应用程序并上传之前运行此命令

bundle package

from this link 从这个连结
https://aws.amazon.com/blogs/devops/locally-packaging-gem-dependencies-for-ruby-applications-in-elastic-beanstalk/ https://aws.amazon.com/blogs/devops/locally-packaging-gem-dependencies-for-ruby-applications-in-elastic-beanstalk/

Two things usually solve this for me. 通常有两件事为我解决。

  1. I didn't bundle install. 我没有捆绑安装。
  2. Sometimes, I have to run things with bundle exec 有时,我必须使用bundle exec来运行

bundle exec <Your path> puma

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

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