Amer Bearat
Amer Bearat

Reputation: 946

ec2 instance "Could not locate Gemfile or .bundle/ directory"

I'm having trouble with uploading and deploying ruby app on Elastic Beanstalk

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)'.

enter image description here



here is part of the code on line 221 from bundler.rb from the ec2 instance

  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

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

Here is an image of GemFile enter image description here



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/

Upvotes: 0

Views: 810

Answers (1)

CwakrJax
CwakrJax

Reputation: 23

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 <Your path> puma

Upvotes: 1

Related Questions