簡體   English   中英

Heroku 推送被拒絕,無法通過 Bundler 安裝 gems

[英]Heroku push rejected, failed to install gems via Bundler

我正在努力將我的代碼推送到 Heroku。在搜索 Google 和 Stack Overflow 問題后,我一直無法找到解決方案。 這是我嘗試“git push heroku master”時得到的結果:

Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.3
       Unresolved dependencies detected; Installing...
       Fetching source index for http://rubygems.org/
       /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:300:in `open_uri_or_path': bad response Not Found 404 (http://rubygems.org/quick/Marshal.4.8/mail-2.2.6.001.gemspec.rz) (Gem::RemoteFetcher::FetchError)
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:172:in `fetch_path'
.
....

最后:

FAILED: http://docs.heroku.com/bundler
 !     Heroku push rejected, failed to install gems via Bundler

error: hooks/pre-receive exited with error code 1
To git@heroku.com:myapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:myapp.git'

謝謝你的幫助!

我不認為這是 Rails 版本問題,也不是 Heroku 特有的問題。 (我今天遇到了同樣的問題,在我的本地開發機器上運行bundle install時,使用 Rails 3.0.3。)

正如安德魯建議的那樣,在本地運行bundle update解決這個問題。

編輯:正如評論中所建議的:記得git add . , git commit -m "message"

我是這樣解決這個問題的:

  1. 捆綁更新
  2. git add Gemfile.lock
  3. git commit -m '為 Heroku 更新 Gemfile.lock'
  4. git push heroku master

我有同樣的問題: remote: ! Failed to install gems via Bundler. remote: ! Failed to install gems via Bundler.

如果你看到問題是這樣的:

remote:  Your bundle only supports platforms ["x86_64-darwin-16"] but your local platform
remote:  is x86_64-linux. Add the current platform to the lockfile with `bundle  loc
remote:  --add-platform x86_64-linux` and try again.

它的意思是:

Your bundle only supports platforms ["x86_64-darwin-16"] but your local platform is x86_64-linux. Add the current platform to the lockfile with `bundle loc --add-platform x86_64-linux` and try again.

如果你在你的 gemfile.loc 中看到你只有這個:

PLATFORMS
  x86_64-darwin-16

所以我做了這個命令,在 gemfile.loc 中添加你的平台

bundle lock --add-platform x86_64-linux

這將更新您的 Gemfile.loc :

PLATFORMS
  x86_64-darwin-16
  x86_64-linux

繼續:

git add .
git commit -m "add platform x86_64-linux"

再推

git push heroku master:main

解決!

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux
bundle install
git add .
git commit -m "Bundler fix"

使用:

rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock

我在我的本地Gemfile.lock上有Gemfile.lock確保從本地服務器和 HEROKU V 機器中刪除它。

另一個提示:打開你的 Gemfile.lock 並檢查這個塊是否存在:

PLATFORMS
  x86_64-darwin-20

如果存在,請運行以下命令: bundle config force_ruby_platform true

現在,您必須重新創建整個 Gemfile.lock,因為有些 gem 可以只為 MacOS 構建。 所以,只需刪除Gemfile.lock並運行bundle install (不要忘記停止 spring,如果它正在運行,否則 spring 會自動重新創建 Gemfile.lock 文件)

  1. 捆綁更新
  2. git add Gemfile.lock
  3. git commit -m '為 Heroku 更新 Gemfile.lock'
  4. git push heroku master

它對我有用。

運行:bundle lock --add-platform x86_64-linux

  1. 捆綁更新
  2. git add Gemfile.lock
  3. git commit -m '為 Heroku 更新 Gemfile.lock'
  4. git push heroku master

我很確定 Heroku 只支持某些版本的 Rails,因此您需要至少使用 3.0,而不是候選發布版本。 更新您的 gemfile 中的 Rails 版本,運行bundle update ,然后嘗試推送到 Heroku。

我實際上通過在讓事情靜置幾分鍾后再次將其推上來解決了它......我從頭開始重新旋轉我的 dokku 系統並在我之前嘗試解決方法的同一天遇到了同樣的問題更新 nokogiri。 那是我意識到的時候,這似乎是herokuish的一個奇怪之處; 它並不總是第一次推動。

我想知道它是否在幕后安裝庫頭文件,並且當它們花費太長時間時,bundler 只是安裝失敗。

我得到相同的 - 404:

curl -v -I http://rubygems.org/quick/Marshal.4.8/mail-2.2.6.001.gemspec.rz

在您的 Gemfile 中,您可以嘗試指定此 gem 的較低版本號嗎? 2.2.5 也許?

我的問題是關於 pg gem。

使用 'brew install postgres' 安裝 postgres 捆綁完成后。

然后執行 Dyo Medio 描述的命令,我設法在 Heroku 上部署了應用程序。

我今天能夠通過以下步驟清除緩存來解決這個問題(並被告知必須在每次部署時完成,直到找到並消除錯誤):首先安裝插件:

  heroku plugins:install heroku-builds

然后使用以下命令清除緩存:

  heroku builds:cache:purge -a example-app

緩存將在下一次部署時重建。 如果您沒有任何新代碼要部署,您可以推送一個空提交。

  $ git commit --allow-empty -m "Purge cache"
  $ git push heroku master

其中 example-app 替換為您要為其清除緩存的應用程序的名稱。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM