Could not locate Gemfile
Solution 1
You do not have Gemfile
in a directory where you run that command.
Gemfile
is a file containing your gem
settings for a current program.
Solution 2
Make sure you are in the project directory before running bundle install
. For example, after running rails new myproject
, you will want to cd myproject
before running bundle install
.
Solution 3
I had the same problem and got it solved by using a different directory.
bash-4.2$ bundle install Could not locate Gemfile bash-4.2$ pwd /home/amit/redmine/redmine-2.2.2-0/apps/redmine bash-4.2$ cd htdocs/ bash-4.2$ ls app config db extra Gemfile lib plugins Rakefile script tmp bin config.ru doc files Gemfile.lock log public README.rdoc test vendor bash-4.2$ cd plugins/ bash-4.2$ bundle install Using rake (0.9.2.2) Using i18n (0.6.0) Using multi_json (1.3.6) Using activesupport (3.2.11) Using builder (3.0.0) Using activemodel (3.2.11) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.1) Using rack-cache (1.2) Using rack-test (0.6.1) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.2.1) Using actionpack (3.2.11) Using mime-types (1.19) Using polyglot (0.3.3) Using treetop (1.4.10) Using mail (2.4.4) Using actionmailer (3.2.11) Using arel (3.0.2) Using tzinfo (0.3.33) Using activerecord (3.2.11) Using activeresource (3.2.11) Using coderay (1.0.6) Using rack-ssl (1.3.2) Using json (1.7.5) Using rdoc (3.12) Using thor (0.15.4) Using railties (3.2.11) Using jquery-rails (2.0.3) Using mysql2 (0.3.11) Using net-ldap (0.3.1) Using ruby-openid (2.1.8) Using rack-openid (1.3.1) Using bundler (1.2.3) Using rails (3.2.11) Using rmagick (2.13.1) Your bundle i
Solution 4
I solved similar problem just by backing out of the project directory, then cd back into the project directory and bundle install.
Solution 5
Is very simple. when it says 'Could not locate Gemfile' it means in the folder you are currently in or a directory you are in, there is No a file named GemFile. Therefore in your command prompt give an explicit or full path of the there folder where such file name "Gemfile" is e.g cd C:\Users\Administrator\Desktop\RubyProject\demo.
It will definitely be solved in a minute.
Related videos on Youtube

ianyoung
Updated on January 18, 2022Comments
-
ianyoung over 1 year
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.
-
ianyoung over 12 yearsYes, this was indeed the problem and I managed to get it sorted out in the end. Thanks for your help.
-
ianyoung over 12 yearsThanks. It was something this simple. I just had a problem because I had to be logged in as an admin user to run the command but the gemfile was in a directory under a different user. I managed to get it sorted. Thanks!
-
Tim Wong over 8 yearsyes, you are right, if you use this command for install redmine, you should 'cd [redmine-directory]' then execute that command.