我怎么能在别处运行bundle install?

时间:2013-11-29 15:11:57

标签: ruby-on-rails-3.2

$ git push heroku master
Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (61/61), done.
Writing objects: 100% (70/70), 16.06 KiB | 0 bytes/s, done.
Total 70 (delta 2), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       New app detected loading default bundler cache
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --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:
       * pg
       * rails_12factor
       Bundler Output: 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:
       * pg
       * rails_12factor
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:obscure-reaches-5507.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:obscure-reaches-5507.git'

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

这个问题很糟糕,因为你向heroku服务器提交了错误的Gemfile.lock(pg和rails_12factor gems)。您需要在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

答案 1 :(得分:0)

在您的宝石文件中,您可以添加所有必需的宝石以及rails_12factor并尝试

gem 'rails_12factor', group: :production

gem 'rails_serve_static_assets','~> 0.0.4', group: :production

gem 'rails_stdout_logging','~> 0.0.3',group: :production