简体   繁体   English

! 无法通过 Bundler Heroku Rails 安装 gems

[英]! Failed to install gems via Bundler Heroku Rails

I'm super new to RoR and am attempting to deploy my app on heroku.我是 RoR 的超级新手,正在尝试在 heroku 上部署我的应用程序。 I'm getting the error you can see in the title.我收到标题中显示的错误。

Gemfile:宝石文件:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.0'
gem 'mail_form'
gem 'figaro'
gem 'rails', '~> 6.1.0'
# gem 'sqlite3', '~> 1.4'
gem 'puma', '~> 5.0'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 5.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.4', require: false
gem 'devise', '~> 4.7', '>= 4.7.3'
gem 'pg'

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 4.1.0'
  gem 'rack-mini-profiler', '~> 2.0'
  gem 'listen', '~> 3.3'
  gem 'spring'
end

group :test do
  gem 'capybara', '>= 3.26'
  gem 'selenium-webdriver'
  gem 'webdrivers'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Stack

Enumerating objects: 424, done.
Counting objects: 100% (424/424), done.
Delta compression using up to 8 threads
Compressing objects: 100% (391/391), done.
Writing objects: 100% (424/424), 265.61 KiB | 6.18 MiB/s, done.
Total 424 (delta 193), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-18 stack
remote: -----> Determining which buildpack to use for this app
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:                         Detected buildpacks: Ruby,Node.js
remote:                         See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.16
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.0
remote: -----> Installing dependencies using bundler 2.2.16
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Unable to find a spec satisfying nokogiri (>= 1.8.5) in the set. Perhaps the
remote:        lockfile is corrupted? Found nokogiri (1.11.7-x86_64-darwin), nokogiri
remote:        (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin), nokogiri
remote:        (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin) that did not match the
remote:        current platform.
remote:        Bundler Output: Unable to find a spec satisfying nokogiri (>= 1.8.5) in the set. Perhaps the
remote:        lockfile is corrupted? Found nokogiri (1.11.7-x86_64-darwin), nokogiri
remote:        (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin), nokogiri
remote:        (1.11.7-x86_64-darwin), nokogiri (1.11.7-x86_64-darwin) that did not match the
remote:        current platform.
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: 

I have gone through every previous question on here and tried all the solutions.我已经在这里完成了以前的每个问题并尝试了所有解决方案。 I have already tried to delete the gemfile.lock and run bundle install again to reset it.我已经尝试删除 gemfile.lock 并再次运行 bundle install 来重置它。 I have done various git add, commits and pushes.我已经完成了各种 git add、commits 和 pushes。 I'm kind of at a loss of where to go from here.我有点不知所措。 Any advice would be super appreciated.任何建议将不胜感激。

nokogiri (1.11.7-x86_64-darwin) is native gem for Darwin/MacOS , but Heroku run Linux so that it unable to find . nokogiri (1.11.7-x86_64-darwin)Darwin/MacOS的原生 gem,但是 Heroku 运行Linux所以它unable to find

the solution is avoid-using-a-precompiled-native-gem , in your case, bundler version 2.2.+, then you'll need to run bundle config set force_ruby_platform true解决方案是避免使用-a-precompiled-native-gem ,在您的情况下, bundler器版本 2.2.+,然后您需要运行bundle config set force_ruby_platform true

you should re-check that Gemfile.lock does not contain nokogiri (1.11.7-x86_64-darwin) , it should contain nokogiri (~>...)你应该重新检查Gemfile.lock不包含nokogiri (1.11.7-x86_64-darwin) ,它应该包含nokogiri (~>...)

I came across the same issue on the M1 Macbook.我在 M1 Macbook 上遇到了同样的问题。 I deleted the Gemfile.lock , then ran bundle install to re-build the Gemfile.lock and this fixed the above error.我删除了Gemfile.lock ,然后运行 bundle install 重新构建Gemfile.lock并修复了上述错误。

Running bundle update nokogiri updated only the Nokogiri gem dependencies for me without updating the rest of the Gemfile运行bundle update nokogiri只为我更新了 Nokogiri gem 依赖项,而没有更新 Gemfile 的其余部分

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

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