Heroku 推送被拒绝,无法通过 Bundler 安装 gem
我正在努力将我的代码推送到 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 [email protected]:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'
感谢您的帮助!
I am struggling to push my code to Heroku. And after searching on Google and Stack Overflow questions, I have not been able to find the solution. Here is What I get when I try "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'
.
....
And finally:
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 [email protected]:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
我有同样的问题:
远程:!无法通过 Bundler 安装 gem。
如果你看到问题是这样的:
它的意思是:
如果你在 gemfile.loc 中看到你只有这个:
所以我执行了这个命令,在 gemfile 中添加你的平台。 loc
这将更新您的 Gemfile.loc :
继续 :
再次推送
解决!
I have same issue:
remote: ! Failed to install gems via Bundler.
if you see the problem is this:
its mean this :
If you see in your gemfile.loc you only have this :
So I did this command, To add in your platform in gemfile.loc
This will update your Gemfile.loc :
Continue :
Push again
Solve!
我不认为这是 Rails 版本问题,也不是 Heroku 特有的问题。 (今天,当我使用 Rails 3.0.3 在本地开发计算机上运行
bundle install
时,我遇到了同样的问题。)按照 Andrew 的建议,在本地运行
bundle update
修复了问题。编辑:
正如评论中所建议的:记住
git add .
,git commit -m "message"
I don't think it's a Rails version problem, nor is it specific to Heroku. (I hit the same problem today, when running
bundle install
on my local development machine, with Rails 3.0.3.)Running
bundle update
locally, as Andrew suggested, fixes the issue.Edit:
As suggested in the comments: remember to
git add .
,git commit -m "message"
我这样解决了这个问题:
I solved this issue this way:
另一个提示:
打开 Gemfile.lock 并检查该块是否存在:
如果存在,请运行以下命令:
bundle config force_ruby_platform true
现在,您必须重新创建整个 Gemfile.lock,因为某些 gem 只能针对 MacOS 构建。因此,只需删除
Gemfile.lock
并运行bundle install
(不要忘记停止 spring,如果它正在运行,否则 spring 会自动重新创建 Gemfile.lock 文件)Another tip:
Open your Gemfile.lock and check if this block exists:
If it exists, run the following command:
bundle config force_ruby_platform true
Now, you must recreate the whole Gemfile.lock, because some gems can be builded just for MacOS. So, just remove the
Gemfile.lock
and runbundle install
(do no forget to stop spring, if it's running, otherwise spring automatically recreates the Gemfile.lock file)使用:
我的本地服务器上有
Gemfile.lock
确保从本地服务器和 HEROKU V 机器中删除它。
Use:
I had
Gemfile.lock
at my localservermake sure to delete it from the localserver AND also the HEROKU V-machine.
它对我有用。
it worked for me.
运行:bundle lock --add-platform x86_64-linux
Run: bundle lock --add-platform x86_64-linux
我很确定 Heroku 仅支持某些版本的 Rails,因此您至少需要使用 3.0,而不是候选版本。更新 gemfile 中的 Rails 版本,运行
bundle update
,然后尝试推送到 Heroku。I'm pretty sure Heroku only supports certain versions of Rails, so you need to be on at least 3.0, instead of a release candidate. Update the version of Rails in your gemfile, run
bundle update
, and then try to push to Heroku.我得到同样的结果 - 404:
在你的 Gemfile 中你可以尝试指定这个 gem 的较低版本号?也许是2.2.5?
I get the same - 404:
In your Gemfile you could try specifying a lower version number of this gem? 2.2.5 perhaps?
实际上,我只是在让事情静置几分钟后再次将其推高就解决了这个问题...我从头开始重新旋转我的 dokku 系统,并在我之前尝试解决方法后的同一天遇到了同样的问题更新 nokogiri。就在那时我意识到,这似乎是一种英雄主义的奇怪现象;它并不总是首先推动。
我想知道它是否在幕后安装库标头,当它们花费太长时间时,捆绑器就会安装失败。
I actually solved it by simply pushing it up a second time after letting things sit for a few minutes... I have re-spun my dokku system from scratch and encountered the same issue, on the same day after I had previously attempted a workaround of updating nokogiri. That was when I realized, this seems to be an oddity of herokuish; it doesn't always take on the first push.
I wonder if behind the scenes it's installing library headers, and when they take too long, bundler simply fails the install.
我的问题是关于 pg gem 的。
使用“brew install postgres”安装 postgres 后,捆绑完成。
然后执行 Dyo Medio 描述的命令,我设法在 Heroku 上部署该应用程序。
My problem was about pg gem.
After installing postgres with 'brew install postgres' bundling finished.
Then doing commands Dyo Medio described, I managed to deploy the app on Heroku.
我今天能够通过以下步骤清除缓存来克服这个问题(并被告知每次部署都必须完成此操作,直到发现并消除错误):
首先安装插件:
然后使用以下命令清除缓存:
缓存将在下次部署时重建。如果您没有任何新代码要部署,则可以推送空提交。
其中 example-app 替换为您要清除缓存的应用程序的名称。
I was able to overcome this very issue today by purging the cache with steps (and was told it has to be done with each deployment until the bug is found and squashed):
First install the plugin:
Then use the following command to clear the cache:
The cache will be rebuilt on the next deploy. If you do not have any new code to deploy, you can push an empty commit.
Where example-app is replaced by the name of the app you want to clear the cache for.
对我来说,我的 git 存储库中有来自
vendor/cache
的文件,这就是问题所在(即使vendor/cache
已经在我的 gitignore 中)。无论如何:
将
vendor/cache
添加到您的 gitignore(如果尚未添加)并运行For me, I had files from
vendor/cache
in my git repo and that was the issue (even thoughvendor/cache
was already in my gitignore).Anyways:
Add
vendor/cache
to your gitignore if you haven't already and run