Could not locate Gemfile

前端 未结 6 1655
情书的邮戳
情书的邮戳 2020-12-23 09:03

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

相关标签:
6条回答
  • 2020-12-23 09:06

    Here is something you could try.

    Add this to any config files you use to run your app.

    ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
    require 'bundler/setup' # Set up gems listed in the Gemfile.
    Bundler.require(:default)
    

    Rails and other Rack based apps use this scheme. It happens sometimes that you are trying to run things which are some directories deeper than your root where your Gemfile normally is located. Of course you solved this problem for now but occasionally we all get into trouble with this finding the Gemfile. I sometimes like when you can have all you gems in the .bundle directory also. It never hurts to keep this site address under your pillow. http://bundler.io/

    0 讨论(0)
  • 2020-12-23 09:13

    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.

    0 讨论(0)
  • 2020-12-23 09:13

    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
    
    0 讨论(0)
  • 2020-12-23 09:22

    I solved similar problem just by backing out of the project directory, then cd back into the project directory and bundle install.

    0 讨论(0)
  • 2020-12-23 09:26

    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.

    0 讨论(0)
  • 2020-12-23 09:27

    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.

    0 讨论(0)
提交回复
热议问题