bundle install工作,但bundle-show给出错误“rails.git尚未检出。请运行`bundle install`”

时间:2013-01-21 23:13:44

标签: ruby-on-rails github gem bundler

我最近更新了我们的Gemfile,以便在我们的github帐户上使用分叉复制rails。我们已经在2.3稳定分支(我称之为the_bugfix_branch)之外创建了一个自定义分支,并为每个宝石添加了gemspecs,以便捆绑器找到它们。

我的Gemfile有以下内容:

git 'git://github.com/ourgithub/rails.git', :branch => "the_bugfix_branch"  do
  # Note: load-order is essential for dependencies
  gem 'activesupport', '2.3.2' # this must go first
  gem 'actionpack',    '2.3.2' # this must go second
  gem 'actionmailer',  '2.3.2' 
  gem 'activerecord',  '2.3.2' 
  gem 'activeresource','2.3.2' 
  gem 'rails',         '2.3.2' # this must go last
end

bundle install愉快地给我(在所有其他宝石输出中):

Using actionpack (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch) 
Using actionmailer (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch) 
Using activesupport (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch) 
Using activerecord (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch) 
Using activeresource (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch) 
...
Using rails (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

然后我签入并提交Gemfile.lock,其中包含:

GIT
  remote: git://github.com/ourgithub/rails.git
  revision: 3fc562f9b1def3ad9a7abbfd5ccfa713a6dbc39f
  branch: the_bugfix_branch
  specs:
    actionmailer (2.3.2)
      actionpack (= 2.3.2)
    actionpack (2.3.2)
      actionpack (= 2.3.2)
    activerecord (2.3.2)
      activesupport (= 2.3.2)
    activeresource (2.3.2)
      activesupport (= 2.3.2)
    activesupport (2.3.2)
    rails (2.3.2)
      actionmailer (= 2.3.2)
      actionpack (= 2.3.2)
      activerecord (= 2.3.2)
      activeresource (= 2.3.2)
      activesupport (= 2.3.2)
      rake (>= 0.8.3)

但是,如果我尝试启动服务器,它会告诉我:

The git source git://github.com/ourgithub/rails.git is not yet checked out. Please run `bundle install` before trying to start your application

如果我尝试bundle show railsbundle check

,我也会收到完全相同的消息
> bundle show rails
The git source git://github.com/ourgithub/rails.git is not yet checked out. Please run `bundle install` before trying to start your application
> bundle check
git://github.com/ourgithub/rails.git (at the_bugfix_branch) is not checked out. Please run `bundle install`

如果我尝试bundle install --deployment(只是为了踢),它会给出:

> bundle install --deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

You have added to the Gemfile:
* source: git://github.com/ourgithub/rails.git (at the_bugfix_branch)

You have deleted from the Gemfile:
* source: git://github.com/ourgithub/rails.git (at the_bugfix_branch)

You have changed in the Gemfile:
* activeresource from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* activerecord from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* actionmailer from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* actionpack from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* activesupport from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* rails from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`

我显然只是更改了我的Gemfile,而且我肯定已经运行bundle install,因为我将这些东西添加到Gemfile中。

我用谷歌搜索“还没有检出。请在尝试启动你的应用程序之前运行bundle install并且所有bundle install赢了”工作“我可以找到的问题似乎说”只是运行bundle install然后检查你的Gemfile.lock的副本......我已经明确地做了。它们也往往是关于捆绑安装失败的生产,但我的开发也失败了。

我认为这不是简单 Gemfile / Gemfile.lock不匹配问题!

一些谷歌搜索结果告诉我尝试删除.bundle / config并再次运行它。我已经尝试过同样的(缺乏)效果。

具体来说,在重新运行捆绑安装之前,我仔细阅读了本故障排除指南的所有rm -rf行:https://github.com/carlhuda/bundler/blob/master/ISSUES.md

错误消息没有变化。

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

Taryn East说:

  

我认为这不是简单 Gemfile / Gemfile.lock不匹配问题!

原来我错了。

解决方案是删除Gemfile中的版本号,并显式使用分支:

git 'git://github.com/ourgithub/rails.git', :branch => "the_bugfix_branch"  do
  # Note: load-order is essential for dependencies
  gem 'activesupport', :branch => "the_bugfix_branch" # this must go first
  gem 'actionpack',    :branch => "the_bugfix_branch" # this must go second
  gem 'actionmailer',  :branch => "the_bugfix_branch" 
  gem 'activerecord',  :branch => "the_bugfix_branch" 
  gem 'activeresource',:branch => "the_bugfix_branch" 
  gem 'rails',         :branch => "the_bugfix_branch" # this must go last
end

bundler一方面与版本号混淆,另一方面与分支混淆。

为列出的每个宝石明确设置分支,似乎终于可以做到了!