几个小时以来,我一直在努力解决这个错误,但没有取得任何进展。我试过在不同的环境中运行 bundle install 但没有成功。我不确定发生了什么,我觉得错误似乎不再提供相关反馈。但是,我使用的是 Ruby 1.9.3,当我推送它时,它指出 Heroku 使用的是 ruby 2.0.0。这可能与它有关吗?
Castillos-MacBook-Pro:reservester-nysum13 castillo$ git push heroku master
Identity added: /Users/castillo/.ssh/id_rsa (/Users/castillo/.ssh/id_rsa)
Counting objects: 66, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (66/66), 26.25 KiB, done.
Total 66 (delta 4), reused 38 (delta 1)
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
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:
* debugger
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:
* debugger
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby/Rails app
To git@heroku.com:guarded-sierra-5306.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:guarded-sierra-5306.git'
gem 'debugger' 最初被放置在环境组之外。我将其移至开发组并重新运行 bundle。
这是我的 Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'therubyracer'
gem 'twitter-bootstrap-rails'
gem 'carrierwave'
gem 'rmagick'
gem "fog", "~> 1.3.1"
gem "devise"
gem "figaro"
gem "galetahub-simple_captcha", :require => "simple_captcha"
group :development do
gem 'annotate'
gem 'sqlite3'
gem 'rspec-rails', '~> 2.0'
gem 'debugger'
end
group :production do
gem 'pg'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
最佳答案
我遇到了类似的错误。我尝试手动删除 Gemfile.lock 文件,重新捆绑,将其推送到 git,但仍然没有成功。 但最后我通过将我的 rvm 版本更改为 ruby 2.0.0 使其工作,使用此命令预编译 Assets
RAILS_ENV=production bundle exec rake assets:precompile
并删除 Gemfile.lock,重新捆绑并推送到 github。最后一部分,当你使用你的分支而不是你的 master 进入 heroku 时,发生这种情况是因为你没有使用此命令将 master 分支部署到 heroku master 分支:
git push heroku your-branch:master
关于ruby-on-rails-3 - 推送到 Heroku 时出现问题。在其他地方运行 `bundle install` 并将更新后的 Gemfile.lock 添加到版本控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17319665/