Heroku推被拒绝,未能通过Bundler安装宝石

时间:2011-01-01 13:24:11

标签: ruby-on-rails rubygems heroku ruby-on-rails-3 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'

感谢您的帮助!

11 个答案:

答案 0 :(得分:36)

我认为这不是Rails版本的问题,也不是Heroku特有的。 (今天我在本地开发机器上使用Rails 3.0.3运行bundle install时遇到了同样的问题。)

正如安德鲁建议的那样,在本地运行bundle update可以解决问题。

<强> 修改 : 正如评论中所建议的那样:记得git add .git commit -m "message"

答案 1 :(得分:12)

我有同样的问题: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

解决!

答案 2 :(得分:7)

我用这种方式解决了这个问题:

  1. 捆绑更新
  2. git add Gemfile.lock
  3. git commit -m&#39;更新Heroku&#39;
  4. 的Gemfile.lock
  5. git push heroku master

答案 3 :(得分:5)

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

答案 4 :(得分:3)

使用:

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

我的本​​地服务器上有Gemfile.lock 确保从本地服务器和HEROKU V-machine中删除它。

答案 5 :(得分:3)

另一个提示: 打开你的 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 文件)

答案 6 :(得分:2)

运行: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

答案 7 :(得分:1)

我很确定Heroku只支持某些版本的Rails,所以你需要至少3.0,而不是候选版本。更新gemfile中的Rails版本,运行bundle update,然后尝试推送到Heroku。

答案 8 :(得分:0)

我也一样 - 404:

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

在您的Gemfile中,您可以尝试指定此gem的较低版本号? 2.2.5或许?

答案 9 :(得分:0)

我实际上解决了它,只是在让东西停留几分钟之后再推它一次......我从头开始重新旋转我的dokku系统并遇到同样的问题,在我之前的同一天尝试更新nokogiri的解决方法。那时我意识到,这似乎是一种古怪的诡计;它并不总是采取第一次推动。

我想知道它是否在幕后安装了库标题,而且当它们花费的时间太长时,捆绑包就完全无法安装。

答案 10 :(得分:0)

  1. 捆绑更新
  2. git添加Gemfile.lock
  3. git commit -m'为Heroku更新Gemfile.lock'
  4. git push heroku master

对我有用。