Heroku로 푸시 할 때 Failed to install gems via Bundler. 오류가 발생한 경우 해결 방법

10044 단어 경 6루비Rails

개발 환경



MacOS Big Sur version11.2.3
Ruby 3.0.0
Rails 6.0.4

오류가 발생한 경위



앱 작성 중, 좋아! 나머지는 Heroku에 배포뿐입니다! ! ! 그리고,$git push heroku master 라고 치면, Failed to install gems via Bundler 의 에러가 발생.

터미널
$git push heroku master
# ...(省略)...
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-3.0.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:        Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with `bundle lock
remote:        --add-platform x86_64-linux` and try again.
remote:        Bundler Output: Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with `bundle lock
remote:        --add-platform x86_64-linux` and try again.
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...

해결책


Failed to install gems via Bundler 를 대략적으로 번역해 보면, bundler를 경유해 gem의 인스톨에 실패했다고 하는 것.

에러문을 잘 읽으면 다음과 같이 쓰여 있다.

터미널
Bundler Output: Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with `bundle lock
remote:        --add-platform x86_64-linux` and try again.

현재 로컬로 사용하고 있는 것은 MacOS(Darwin)이지만, Heroku의 플랫폼은 Linux이기 때문에 다르다~라고 할까.

에러문에 써 있는 아래의 커멘드를 실행.

터미널
$bundle lock --add-platform x86_64-linux

Fetching gem metadata from https://rubygems.org/............
Resolving dependencies...
Writing lockfile to /Users/macbook/Desktop/BrainTraining/Gemfile.lock
#できたぽい。

#変更したので再度add,commit
$git add -A
$git commit -m "fix Gemfile.lock"

$git push heroku master
# ...(省略)...
remote: Verifying deploy... done.
To https://git.heroku.com/******.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'heroku'.
# Herokuへのデプロイができた!!

대답은 에러문 안에...! ! !
좋은 공부가되었습니다

좋은 웹페이지 즐겨찾기