[英]! Failed to install gems via Bundler Heroku Rails
我是 RoR 的超级新手,正在尝试在 heroku 上部署我的应用程序。 我收到标题中显示的错误。
宝石文件:
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]
堆
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:
我已经在这里完成了以前的每个问题并尝试了所有解决方案。 我已经尝试删除 gemfile.lock 并再次运行 bundle install 来重置它。 我已经完成了各种 git add、commits 和 pushes。 我有点不知所措。 任何建议将不胜感激。
nokogiri (1.11.7-x86_64-darwin)
是Darwin/MacOS
的原生 gem,但是 Heroku 运行Linux
所以它unable to find
。
解决方案是避免使用-a-precompiled-native-gem ,在您的情况下, bundler
器版本 2.2.+,然后您需要运行bundle config set force_ruby_platform true
你应该重新检查Gemfile.lock
不包含nokogiri (1.11.7-x86_64-darwin)
,它应该包含nokogiri (~>...)
我在 M1 Macbook 上遇到了同样的问题。 我删除了Gemfile.lock
,然后运行 bundle install 重新构建Gemfile.lock
并修复了上述错误。
运行bundle update nokogiri
只为我更新了 Nokogiri gem 依赖项,而没有更新 Gemfile 的其余部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.