1

我最近更新了我们的 Gemfile 以在我们的 github 帐户上使用分叉的复制 rails。我们从 2.3-stable 分支(我称之为the_bugfix_branch)创建了一个自定义分支,并为每个 gem 添加了 gemspecs 以使它们可以被 bundler 找到。

我的 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快乐地运行给我(在所有其余的 gem 输出中):

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 rails如果我尝试或,我也会收到完全相同的消息bundle 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,而且自从我将这些东西添加到 Gemfile 以来,我肯定已经运行了 bundle install。

我已经用谷歌搜索了“尚未签出。请bundle install在尝试启动您的应用程序之前运行” ,而我能找到的所有bundle install无法正常工作”的问题似乎都在说“只需运行bundle install然后签入您的副本Gemfile.lock ......我已经清楚地做到了。它们也往往是关于捆绑安装在生产中失败的问题,但我的在开发中也以这种方式失败。

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

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

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

错误消息没有变化。

有任何想法吗?

4

1 回答 1

4

Taryn East said:

I don't think this is a simple Gemfile/Gemfile.lock mismatch problem!

Turns out I was wrong.

The solution was to remove the version-numbers in the Gemfile, and explicitly use the branch instead:

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 was getting confused with the version-number on one hand, and the branch on the other.

Explicitly setting the branch for every gem listed, seemed to finally do the trick!

于 2013-01-22T01:29:05.057 回答