【问题标题】:How do I fix a Bundler Conflict when pushing to Heroku?推送到 Heroku 时如何解决 Bundler 冲突?
【发布时间】:2019-11-08 12:29:23
【问题描述】:

我正在尝试将 Sinatra 应用程序部署到 Heroku。一切都在本地工作。但是,当我尝试将捆绑器成功推送到 Heroku 时,我遇到了一个问题。

我已经尝试删除 Gemfile 锁,然后是以下

bundle update
git add .
git push "Gemfile.lock"
git push heroku master
gem install bundler:2.0.1
bundle install
git add .
git push "Gemfile.lock"
git push heroku master
bundle update --bundler
git add .
git push "Gemfile.lock"
git push heroku master

这是我的 gemfile

source "https://rubygems.org"

# gem "rails"
gem 'sinatra'
gem 'activerecord', '~> 5.2', '>= 5.2.2.1'
gem 'rake'
gem 'sinatra-activerecord'
gem 'require_all'
gem 'bcrypt'
gem 'rack-flash3'
gem 'rb-readline'

group :development, :test do
 gem 'sqlite3'
 gem 'shotgun'
 gem 'pry'
end

group :production do
 gem 'pg'
end

这里是错误信息

remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.5.5
remote: -----> Installing dependencies using bundler 2.0.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Activating bundler (2.0.1) failed:
remote:        Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote:        To update to the latest version installed on your system, run `bundle update --bundler`.
remote:        To install the missing version, run `gem install bundler:2.0.1`
remote:        Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:        
remote:        To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:        Bundler Output: Activating bundler (2.0.1) failed:
remote:        Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote:        To update to the latest version installed on your system, run `bundle update --bundler`.
remote:        To install the missing version, run `gem install bundler:2.0.1`
remote:        Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:        
remote:        To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to infinite-waters-69714.
remote: 
To https://git.heroku.com/infinite-waters-69714.git
 ! [remote rejected] master -> master (pre-receive hook declined)

另外,我已经尝试完全删除 sqlite3 并重复上述过程。

关于如何解决这个问题的任何想法?

【问题讨论】:

  • 本地电脑上的 bundler 和 ruby​​ 版本是什么?

标签: ruby heroku sinatra heroku-postgres


【解决方案1】:

我前段时间遇到过这个问题:我联系​​了 Heroku,他们告诉我他们有一个锁定版本的 Bundler,所以你唯一的选择是使用他们使用的 Bundler 版本:

gem uninstall bundler
gem install bundler -v 2.0.2
bundle update

【讨论】:

  • 这解决了它。谢谢!现在我的应用程序已部署,它无法正常工作,但很高兴这部分已修复。
  • 这是正确的——这是相应的变更日志:devcenter.heroku.com/changelog-items/1656
  • @Donnovan 很高兴为您提供帮助!接受我的回答怎么样?
猜你喜欢
  • 2012-11-18
  • 2011-10-27
  • 2014-08-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-09
相关资源
最近更新 更多