I get this error when installing a gem: “ERROR: While executing gem … (Zlib::GzipFile::Error)” [duplicate]

纵然是瞬间 提交于 2019-12-29 01:56:09

问题


Possible Duplicate:
ERROR: While executing gem … (Zlib::GzipFile::Error) not in gzip format

When installing a gem on my system, I get the following error:

gem install blackbook --version ">= 1.0.7" --source http://github.com/tamoyal/blackbook/tree/master
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

Any ideas as to why this is happening? I built the gem so maybe it is something wrong with my gem build?

Thanks


回答1:


Something isn't set up properly to fetch the gem from GitHub.

try gem fetch -V

steve@macpro:~$ gem fetch blackbook --version ">= 1.0.7" --source http://github.com/tamoyal/blackbook/tree/master -V
GET 301 Moved Permanently: http://github.com/tamoyal/blackbook/tree/master/specs.4.8.gz
GET 200 OK: http://github.com/tamoyal/blackbook/tree/master/
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

You're getting the "not in gzip format" error because gem can't fetch specs.4.8.gz. GitHub returns a 301 redirect back to your project home page, which of course isn't what it wants and isn't gzipped.

Sorry I can't help you further, but I haven't build a gem, much less on GitHub.




回答2:


You didn't mentioned your system. However it happens on Ubuntu if you do not have zlib library. The solution:

sudo apt-get install libzlib-ruby

P.S. I know the question is more than 2 years old. I just hope it might help someone else.




回答3:


Possibly your gem sources are not set up correctly. http://gems.rubyforge.org/ used to be a correct path to rubygems, but it no longer exists.

run this command:

gem sources

If you see http://gems.rubyforge.org/ in your list run:

gem sources -r http://gems.rubyforge.org/

You may also need to add in rubygems.org as a valid source

gem sources -a http://rubygems.org



回答4:


This kind of error was coming to me also. Finally I found that the Proxy settings was not correct. Please check that you can reach the gem server from command line. Just ping it :)



来源:https://stackoverflow.com/questions/937608/i-get-this-error-when-installing-a-gem-error-while-executing-gem-zlibg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!