简体   繁体   English

带Rails 4应用程序的Heroku无法通过Bundler安装gem

[英]Heroku with rails 4 app fails to install gems via Bundler

I have seen a lot of questions along these same lines but I have tried bundle updating and committing the updated Gemfile.lock with no success. 我已经看到了很多类似的问题,但是我尝试了捆绑更新和提交更新的Gemfile.lock,但是都没有成功。 Here is the output when I try to push to my heroku git repo: 这是当我尝试推送到我的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

Does anyone have any insight into why this might be failing? 是否有人对为什么会失败有任何见识? The lines showing a change in active_admin haven't been updated since a long time ago and pushes have been made to heroku since then. 自从很久以前就没有更新过active_admin的更改代码行,此后一直推送到heroku。

Also in regards to You are trying to install in deployment mode after changing your Gemfile I have run bundle install and added my Gemfile.lock and pushed multiple times. 另外,关于You are trying to install in deployment mode after changing your Gemfile我已经运行了bundle install并添加了Gemfile.lock并多次推送。 A view of running git status in my project: 我的项目中运行git状态的视图:

# 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)

and my .gitignore: 和我的.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

If you're using a prerelease version of Bundler 1.4 when you run bundle on your local machine, you are running into an issue where the URLs for github gems changed from using the git protocol to https : https://github.com/bundler/bundler/issues/2600 如果在本地计算机上运行bundle时使用的是Bundler 1.4的预发行版,则会遇到一个问题,其中github gems的URL从使用git协议更改为httpshttps : //github.com/bundler / bundler / issues / 2600

To solve this, you should either update to a more-recent pre-release of Bundler 1.4 locally (by running gem install --pre bundler or remove the Bundler 1.4 prerelease and use 1.3.x. 要解决此问题,您应该在本地更新到最新的Bundler 1.4预发行版(通过运行gem install --pre bundler或删除Bundler 1.4的预发行版并使用1.3.x。

This problem is bacause you commit bad (old) Gemfile.lock to heroku server. 此问题是因为您将错误的(旧的)Gemfile.lock提交到heroku服务器。 You need to update Gemfile.lock on heroku after adding/removing gems. 添加/删除宝石后,您需要在heroku上更新Gemfile.lock。

Do following steps: 请执行以下步骤:

  1. save HEROKU_APP_NAME of existing heroku app ( HEROKU_APP_NAME.herokuapp.com ) 保存现有heroku应用(HEROKU_APP_NAME.herokuapp.com)的HEROKU_APP_NAME
  2. remove heroku application from https://dashboard.heroku.com/apps and create new one https://dashboard.heroku.com/apps删除heroku应用程序并创建一个新的
  3. rename new heroku app to old HEROKU_APP_NAME 将新的heroku应用重命名为旧的HEROKU_APP_NAME
  4. remove Gemfile.lock from your git repo 从您的git仓库中删除Gemfile.lock
  5. remove Gemfile.lock form your local project and form .gitignore (if it exist there) 从本地项目中删除Gemfile.lock并从.gitignore中删除(如果存在)
  6. run bundle install 运行捆绑安装
  7. commit changes to git repo ( new created Gemfile.lock ) 提交对git repo的更改(新创建的Gemfile.lock)
  8. run git push heroku master 运行git push heroku master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM