简体   繁体   中英

! Failed to install gems via Bundler Heroku Rails

I'm super new to RoR and am attempting to deploy my app on 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. I have done various git add, commits and 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 .

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

you should re-check that Gemfile.lock does not contain nokogiri (1.11.7-x86_64-darwin) , it should contain nokogiri (~>...)

I came across the same issue on the M1 Macbook. I deleted the Gemfile.lock , then ran bundle install to re-build the Gemfile.lock and this fixed the above error.

Running bundle update nokogiri updated only the Nokogiri gem dependencies for me without updating the rest of the Gemfile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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