ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
Bundler.require(:default)
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
3
在运行 bundle install 之前,请确保您位于项目目录中 . 例如,在运行 rails new myproject 之后,在运行 bundle install 之前,您需要 cd myproject .
6 Answers
我只是通过退出项目目录解决了类似的问题,然后cd回到项目目录并捆绑安装 .
这是你可以尝试的东西 .
将其添加到用于运行应用程序的任何配置文件中 .
Rails和其他基于Rack的应用程序使用此方案 . 有时您会尝试运行某些目录,这些目录比您的Gemfile通常所在的根目录更深 . 当然你现在解决了这个问题但偶尔我们都会遇到麻烦这个发现Gemfile . 我有时喜欢你在.bundle目录中拥有所有宝石的时候 . 将此网站地址保留在您的枕头下永远不会伤害 . http://bundler.io/
我有同样的问题,并通过使用不同的目录解决它 .
在运行
bundle install
之前,请确保您位于项目目录中 . 例如,在运行rails new myproject
之后,在运行bundle install
之前,您需要cd myproject
.您在运行该命令的目录中没有
Gemfile
.Gemfile
是包含当前程序的gem
设置的文件 .很简单 . 当它显示“无法找到Gemfile”时,它意味着您当前所在的文件夹或您所在的目录中,没有名为GemFile的文件 . 因此,在命令提示符下,给出文件名“Gemfile”所在的文件夹的显式或完整路径,例如cd C:\ Users \ Administrator \ Desktop \ RubyProject \ demo .
它肯定会在一分钟内解决 .