Rails Zlib::GzipFile::Error

zhangyuxiu · 2013年01月14日 · 最后由 zhangyuxiu 回复于 2013年01月14日 · 5237 次阅读

运行下列命令时: gem install pg -v '0.11.0' 出现错误: ERROR: While executing gem ... (Zlib::GzipFile::Error) not in gzip format

好像经常出现这样的错误,是怎么回事啊,怎么解决呢?

换个源试试

#1 楼 @googya 我将 Gemfile 的头一行语句换成了:source 'http://ruby.taobao.org' bundle install 后,出现下面的错误: Fetching gem metadata from http://ruby.taobao.org/. Fetching full source index from http://ruby.taobao.org/ Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks! /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:543:in initialize': not in gzip format (Zlib::GzipFile::Error) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:543:innew' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:543:in `gunzip'

貌似还是上面类似的错误。

#2 楼 @zhangyuxiu 先运行 gem install 后,出现下列结果:从 Fetching 可以看出,貌似已经找到了要安装的包。 #gem install pg -v '0.11.0' Fetching: pg-0.11.0.gem (100%) ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /usr/local/lib/ruby/gems/1.9.1 directory.

由于权限不够,我以 root 用户重新执行后,仍是得到下面结果:

gem install pg -v '0.11.0'

ERROR: While executing gem ... (Zlib::GzipFile::Error) not in gzip format

我猜想出现这个错误,是不是跟源是没有关系的啊?

#3 楼 @zhangyuxiu 目录名里面可能有中文名了?

你们等等,是服务器没磁盘空间导致异常了,马上就好

#4 楼 @metal 没有中文字符。

#5 楼 @huacnlee 服务器经常出现这种情况么?现在好了么? 我现在运行,出现的结果是:

gem install pg -v '0.11.0'

Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby --with-pg

你说的服务器,指的是 rubygems 或 taobao.org 源么?

#7 楼 @zhangyuxiu 你现在的问题是 libpq 没有的问题

ruby.taobao.org 现在已经好了的。

#8 楼 @huacnlee 我使用了 yum install libpq 和 yum install libpq-dev , 可是都不成功。你知道怎么解决目前的问题么?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号