ruby !无法通过Bundler Heroku Rails安装gem

yzuktlbb  于 2022-12-22  发布在  Ruby
关注(0)|答案(3)|浏览(150)

我是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。锁定并再次运行bundle install来重置它。我做了各种git add,commits和push。我有点不知所措,不知该从这里走到哪里。任何建议都将非常感谢。

qvk1mo1f

qvk1mo1f1#

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 (~> ...)

zf2sa74q

zf2sa74q2#

我在M1 MacBook上遇到了同样的问题。我删除了Gemfile.lock,然后运行捆绑包安装来重新构建Gemfile.lock,这修复了上述错误。

envsm3lx

envsm3lx3#

运行bundle update nokogiri只为我更新了Nokogiri gem依赖项,而没有更新其余的gem文件

相关问题