无法找到Gemfile

Ian*_*Ian 129 ruby gem bundler

我当然不是Ruby开发人员,但我的服务器上有一个使用Ruby,Gems和Bundler的应用程序.我试图在不同的用户帐户下安装另一个Ruby,但在相同的VPS上.当我去跑步

bundle install
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

无法找到Gemfile

我可以删除./bundle目录的内容,以便重新获取所有Gems以清除错误,但是这会对使用相同Gems和Bundler的其他应用程序产生影响吗?我不想冒险取消其他应用程序.

Jon*_*oni 158

您没有Gemfile在运行该命令的目录中. Gemfile是包含当前程序gem设置的文件.

  • 谢谢.这很简单.我刚遇到问题,因为我必须以管理员用户身份登录才能运行命令,但gemfile位于不同用户下的目录中.我设法让它排序.谢谢! (2认同)

小智 78

在运行之前,请确保您位于项目目录中bundle install.例如,在运行之后rails new myproject,您将需要cd myproject在运行之前bundle install.


小智 6

我有同样的问题,并通过使用不同的目录解决它.

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