0

我已经看到了很多同样的问题,但我尝试过捆绑更新并提交更新的 Gemfile.lock ,但没有成功。这是我尝试推送到我的 heroku git repo 时的输出:

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3-jruby-1.7.4
-----> Installing JVM: openjdk7-latest
-----> Installing dependencies using Bundler version 1.3.2
       Ruby version change detected. Clearing bundler cache.
       Old: jruby 1.7.4 (1.9.3p392) 2013-07-24 fffffff on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64]
       New: jruby 1.7.4 (1.9.3p392) 2013-07-24 fffffff on OpenJDK 64-Bit Server VM 1.7.0_45-b31 [linux-amd64]
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCodebaseOnly=true
       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/gregbell/active_admin.git (at master)
       You have deleted from the Gemfile:
       * source: https://github.com/gregbell/active_admin.git (at master)
       You have changed in the Gemfile:
       * activeadmin from `git://github.com/gregbell/active_admin.git (at master)` to
       `no specified source`
       Bundler Output: Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCodebaseOnly=true
       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/gregbell/active_admin.git (at master)

       You have deleted from the Gemfile:
       * source: https://github.com/gregbell/active_admin.git (at master)

       You have changed in the Gemfile:
       * activeadmin from `git://github.com/gregbell/active_admin.git (at master)` to
       `no specified source`
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Ruby app

有没有人知道为什么这可能会失败?显示 active_admin 更改的行很久以前就没有更新过,从那时起就向 heroku 推送。

另外关于You are trying to install in deployment mode after changing your Gemfile我已经运行 bundle install 并添加了我的 Gemfile.lock 并多次推送。在我的项目中运行 git status 的视图:

# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# .ruby-version
# app/assets/stylesheets/_base.scss
# app/assets/stylesheets/_colors.scss
# app/assets/stylesheets/_footer.scss
# app/assets/stylesheets/_forms.scss
# app/assets/stylesheets/_header.scss
# app/assets/stylesheets/_icons.scss
# app/assets/stylesheets/_k.scss
# app/assets/stylesheets/_k_mixins.scss
# app/assets/stylesheets/_k_ratings.scss
# app/assets/stylesheets/_project_windows.scss
# app/assets/stylesheets/_reset.scss
# app/assets/stylesheets/application.scss
# app/assets/stylesheets/ie_fixes.scss
# app/assets/stylesheets/mixins.scss
nothing added to commit but untracked files present (use "git add" to track)

和我的 .gitignore:

# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

# Ignore database config file
database.yml

*.iml
.rvmrc
.idea
4

2 回答 2

1

如果您在bundle本地计算机上运行时使用的是 Bundler 1.4 的预发布版本,您会遇到一个问题,即 github gems 的 URL 从使用git协议更改为httpshttps ://github.com/bundler/bundler/问题/2600

要解决此问题,您应该在本地更新到最新的 Bundler 1.4 预发行版(通过运行gem install --pre bundler或删除 Bundler 1.4 预发行版并使用 1.3.x。

于 2013-11-09T04:27:54.470 回答
0

这个问题是因为您将错误(旧)Gemfile.lock 提交到 heroku 服务器。添加/删除 gem 后,您需要在 heroku 上更新 Gemfile.lock。

执行以下步骤:

  1. 保存现有 heroku 应用程序的 HEROKU_APP_NAME (HEROKU_APP_NAME.herokuapp.com)
  2. 从https://dashboard.heroku.com/apps删除 heroku 应用程序并创建一个新应用程序
  3. 将新的 heroku 应用重命名为旧的 HEROKU_APP_NAME
  4. 从你的 git repo 中删除 Gemfile.lock
  5. 从本地项目中删除 Gemfile.lock 并形成 .gitignore (如果它存在)
  6. 运行捆绑安装
  7. 提交对 git repo 的更改(新创建的 Gemfile.lock )
  8. 运行 git push heroku master
于 2014-05-15T20:13:30.760 回答