繁体   English   中英

Heroku:在推送到 Heroku 期间,无法通过 MacOS 上 Rails 6 中的 Bundler 安装 gem

[英]Heroku: Failed to install gems via Bundler in Rails 6 on MacOS during pushing to Heroku

我正在尝试使用 Git 在 heroku 上推送我的 rails 6 (6.1.3.1) 应用程序。 我正在使用 heroku CLI。 在开发中一切正常,但每次我尝试将应用程序推送到 heroku 时都会出现此错误。 我更新了 bundler,复制了 gemfile.lock,然后提交到 github。 但是在git push heroku master之后仍然出现这个错误

这是我的 Gemfile

 source 'https://rubygems.org'
 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
 ruby '3.0.1'
 gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
 gem 'pg', '~> 1.2', '>= 1.2.3'
 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
 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]
gem 'dotenv-rails', '~> 2.7', '>= 2.7.6'

Output 在终端:终端

Heroku 构建日志:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
!Warning: Multiple default buildpacks reported the ability to handle this app. The first 
buildpack in the list below will be used.
        Detected buildpacks: Ruby,Node.js
        See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1
-----> Installing dependencies using bundler 2.2.16
   Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle 
   BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
   Your bundle only supports platforms ["x86_64-darwin-17"] but your local platform
   is x86_64-linux. Add the current platform to the lockfile with `bundle lock
   --add-platform x86_64-linux` and try again.
   Bundler Output: Your bundle only supports platforms ["x86_64-darwin-17"] but your local 
   platform
   is x86_64-linux. Add the current platform to the lockfile with `bundle lock
   --add-platform x86_64-linux` and try again.
  !
  !     Failed to install gems via Bundler.
  !
  !     Push rejected, failed to compile Ruby app.
  !     Push failed

我的 Ruby 版本是 3.0.1,我使用的是 MacOS High Sierra 10.13.6

请帮我

我已经成功地解决了这个问题。 问题是平台。 所以我运行这两个命令并修复了这个:

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux

暂无
暂无

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

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