dhan
dhan

Reputation: 43

rails command does not work. getting error "Could not locate Gemfile or .bundle/ directory"

Whenever I try any rails command, even rails -v, I keep getting the error - Could not locate Gemfile or .bundle/ directory

Things I have already tried:

gem install rails (successfully installed)

gem update rails

gem update bundler

tried uninstalling bundler and reinstalling it.

Current ruby -v is: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

None of the above worked. Any ideas?

Upvotes: 1

Views: 875

Answers (1)

Tony Vincent
Tony Vincent

Reputation: 14362

If you have installed rails successfully rails -v should work fine. For running bundle you have to be in a Gemfile directory. Are you sure you are in the root directory of your app? If not cd to your root directory and run the commands

$ rails new my_app
$ cd my_app
$ bundle


EDIT
The problem can occur if you have to be logged in as an admin user to run the command but the gemfile was in a directory under a different user.

Upvotes: 1

Related Questions