Could not locate Gemfile

Viewed 361000

I'm certainly no Ruby developer but I have an application on my server using Ruby, Gems, and Bundler. I am trying to install another Ruby on under a different user account but on the same VPS. When I go to run

bundle install

I get the following error:

Could not locate Gemfile

I could remove the contents of the ./bundle directory so that all Gems are re-fetched to clear the error but will this have an impact on my other application using the same Gems and Bundler? I don't want to risk taking the other app down.

8 Answers

In my case, I was trying to run locally checked out rails code in a script gem "rails", path: "../rails"

Running the script normally as ruby script.rb gave the error Could not locate Gemfile or .bundle/ directory (Bundler::GemfileNotFound)

Setting the Gemfile path similar to @douglasgallen solved it

BUNDLE_GEMFILE="../rails" ruby script.rb

I had to do touch Gemfile.

My case was an AWS Amazon Linux instance and Capistrano setting up Puma.

Related