Forum: Ruby gems installation - invalid gem format

F7141e066d691d7f18765c1ea6389b18?d=identicon&s=25 Serguei Cambour (javix)
on 2009-12-04 16:22
No matter on which OS you are, - XP Family, XP Pro or Ubuntu 9.10. No
matter if you have firewall 'hyper-sensitive' or proxy. When trying to
do gem update --system or even when trying to install a new gem like
'gem install [gem_name] I always got the below error:
------------------------------------------------------
serge@serge-laptop:~$ sudo gem install heroku
ERROR:  Error installing heroku:
  invalid gem format for /usr/lib/ruby/gems/1.8/cache/heroku-1.4.gem

serge@serge-laptop:~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
serge@serge-laptop:~$ gem -v
1.3.5
 I always get the above error of '...invalid gem format..'. Any idea how
to resolve that? Something goes wrong in rubygems
commits/dependencies?Thank you.
Be30361bb0b0c495e3077db43ad84b56?d=identicon&s=25 Aaron Patterson (Guest)
on 2009-12-04 18:43
(Received via mailing list)
On Sat, Dec 05, 2009 at 12:22:41AM +0900, Serguei Cambour wrote:
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
> serge@serge-laptop:~$ gem -v
> 1.3.5
>  I always get the above error of '...invalid gem format..'. Any idea how
> to resolve that? Something goes wrong in rubygems
> commits/dependencies?Thank you.

Does this break with any other gem?  Or is it only the heroku gem?
F7141e066d691d7f18765c1ea6389b18?d=identicon&s=25 Serguei Cambour (javix)
on 2009-12-04 22:16
Aaron Patterson wrote:
> On Sat, Dec 05, 2009 at 12:22:41AM +0900, Serguei Cambour wrote:
>> ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
>> serge@serge-laptop:~$ gem -v
>> 1.3.5
>>  I always get the above error of '...invalid gem format..'. Any idea how
>> to resolve that? Something goes wrong in rubygems
>> commits/dependencies?Thank you.
>
> Does this break with any other gem?  Or is it only the heroku gem?

With any other gem, even when I tried from installing Ruby, then doing
(On Windows or Ubuntu - it was the same):

gem update --system
Updating RubyGems
Updating rubygems-update
ERROR:  While executing gem ... (Gem::InstallError)
    invalid gem format for
C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5
.gem

Installing fromlocal rubygems-update-1.3.5 didn't solve the problem.
Only the error message changed. Instead of

    invalid gem format for
C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5

I got

    invalid gem format for C:/Ruby/lib/ruby/gems/1.8/cache/[gem_name]
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2009-12-05 23:50
(Received via mailing list)
On Dec 4, 6:16 pm, Serguei Cambour <s.camb...@gmail.com> wrote:
>
>
> Installing fromlocal rubygems-update-1.3.5 didn't solve the problem.
> Only the error message changed. Instead of
>
>     invalid gem format for
> C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5
>
> I got
>
>     invalid gem format for C:/Ruby/lib/ruby/gems/1.8/cache/[gem_name]
>

Can you remove 1.8/cache folder and try again?

This time, please execute the install command using --debug -V
options, which will provide us enough information to see where the
problem is.

Thank you,
F7141e066d691d7f18765c1ea6389b18?d=identicon&s=25 Serguei Cambour (javix)
on 2009-12-09 10:12
Luis Lavena wrote:
> On Dec 4, 6:16�pm, Serguei Cambour <s.camb...@gmail.com> wrote:
>>
>>
>> Installing fromlocal rubygems-update-1.3.5 didn't solve the problem.
>> Only the error message changed. Instead of
>>
>> � � invalid gem format for
>> C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5
>>
>> I got
>>
>> � � invalid gem format for C:/Ruby/lib/ruby/gems/1.8/cache/[gem_name]
>>
>
> Can you remove 1.8/cache folder and try again?
>
> This time, please execute the install command using --debug -V
> options, which will provide us enough information to see where the
> problem is.
>
> Thank you,

I tried as you asked, here is the result:


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\serge>ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

C:\Documents and Settings\serge>gem list

*** LOCAL GEMS ***

fxri (0.3.6)
fxruby (1.6.16)
hpricot (0.6.164)
log4r (1.0.5)
ptools (1.1.6)
rake (0.8.1)
ruby-opengl (0.60.0)
test-unit (2.0.1)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)

C:\Documents and Settings\serge>gem update --system --debug -V
Exception `NameError' at
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:134 -
uninitiali
zed constant Gem::Commands::UpdateCommand
Updating RubyGems
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
Exception `Errno::EEXIST' at C:/Ruby/lib/ruby/1.8/fileutils.rb:243 -
File exists - C:/Documents and
Settings/serge/.gem/specs/gems.rubyforge.org%80
GET 200 OK: http://gemcutter.org/latest_specs.4.8.gz
Exception `Errno::EEXIST' at C:/Ruby/lib/ruby/1.8/fileutils.rb:243 -
File exists - C:/Documents and
Settings/serge/.gem/specs/gemcutter.org%80
Updating rubygems-update
GET 200 OK:
http://gemcutter.org/quick/Marshal.4.8/rubygems-up...
Exception `Errno::EEXIST' at C:/Ruby/lib/ruby/1.8/fileutils.rb:243 -
File exists - C:/Documents and
Settings/serge/.gem/specs/gemcutter.org%80/quick/Marshal.4.8
Installing gem rubygems-update-1.3.5
Downloading gem rubygems-update-1.3.5.gem
GET 302 Moved Temporarily:
http://gemcutter.org/gems/rubygems-update-1.3.5.gem
GET 200 OK:
http://s3.amazonaws.com/gemcutter_production/gems/...
Exception `Gem::Package::FormatError' at
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.r
b:112 - No metadata found!
Exception `Gem::InstallError' at
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:116 - invalid
gem format for C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5.gem
ERROR:  While executing gem ... (Gem::InstallError)
    invalid gem format for
C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5.gem
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:116:in
`initialize'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:236:in
`new'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:236:in
`install'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:219:in
`each'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:219:in
`install'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:85:in
`execute'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:81:in
`each'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:81:in
`execute'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:136:in
`invoke'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:105:in
`process_args'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:75:in
`run'
        C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:39:in
`run'
        C:/Ruby/bin/gem:24

C:\Documents and Settings\serge>
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2009-12-09 17:40
(Received via mailing list)
On Dec 9, 6:12 am, Serguei Cambour <s.camb...@gmail.com> wrote:
>
> win32-api (1.2.1, 1.2.0)
>
That means that you remove the cache gem folder? The gem list is only
going to display the installed ones.

> GET 200 OK:http://gemcutter.org/latest_specs.4.8.gz
> GET 302 Moved Temporarily:http://gemcutter.org/gems/rubygems-update-1.3.5.gem
> GET 200 OK:http://s3.amazonaws.com/gemcutter_production/gems/......
> Exception `Gem::Package::FormatError' at
> C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.r
> b:112 - No metadata found!

Can you enter the following URL in your browser, download it to a
location and then try installing it?

http://gemcutter.org/gems/rubygems-update-1.3.5.gem

The downloaded file should weight 279K.

then, from the command line where you downloaded that file:

gem install rubygems-update-1.3.5.gem

If doesn't work, then you're behind a firewall or proxy that is
blocking all the Amazon S3 downloads and is downloading garbage that
RubyGems cannot install
F7141e066d691d7f18765c1ea6389b18?d=identicon&s=25 Serguei Cambour (javix)
on 2009-12-11 09:56
I think I found the reason. I just opened the file that Ruby pointed in
(C:/Ruby/lib/ruby/gems/1.8/cache/[gem_name]. Here is what was inside (I
had to do that much earlier without loosing so much time :(:
[code]
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head><body><header>
</header>

<center><img src="http://192.168.50.254:7000/blocked.jpg">
<p><b>This website is blocked.</b></p>
<p><b>To unlock it's content, please send a request to <a
href="mailto:support@mydomain.com">support@mydomain.com</a></b></p>
</center>
</body></html>
[/code]
As you can see, the problem was that Ruby tried to go through the port
7000 that was blocked by the enterprise firewall.
Just to be sure at 100%, I took 2 laptops: with Windows XP Family and
Ubuntu 9.10 and tried to install RoR environment at home where I know
exactly my firewall configuration. And, as I expected, everything was
installed without any problem.
Thank you so much for your help. I'd like that Ruby error message to be
more user-friendly, like that one could get an idea more quickly where
to search.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2009-12-11 20:17
(Received via mailing list)
On Dec 11, 5:56 am, Serguei Cambour <s.camb...@gmail.com> wrote:
> <p><b>This website is blocked.</b></p>
> installed without any problem.
> Thank you so much for your help. I'd like that Ruby error message to be
> more user-friendly, like that one could get an idea more quickly where
> to search.

It was pointed several times over this thread and by others that you
may be behind a firewall.

A proper firewall shouldn't return HTTP 200 OK but instead something
else.

The problem is not Ruby, but the firewall, how can RubyGems determine
what will do so many proxy/firewalls in relation to blocking of
content?

Glad to know you figure it out.
F7141e066d691d7f18765c1ea6389b18?d=identicon&s=25 Serguei Cambour (javix)
on 2009-12-11 22:34
When I tried to open the url you sent me:

http://gemcutter.org/gems/rubygems-update-1.3.5.gem

I got an error described before:

<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head><body><header>
</header>

<center><img src="http://192.168.50.254:7000/blocked.jpg">
<p><b>This website is blocked.</b></p>
<p><b>To unlock it's content, please send a request to <a
href="mailto:support@mydomain.com">support@mydomain.com</a></b></p>
</center>
</body></html>

That's why it was clear that it was blocked by firewall. And right after
that, I decided to check the file
C:/Ruby/lib/ruby/gems/1.8/cache/[gem_name] and saw the port number.
Thank you again.
F7141e066d691d7f18765c1ea6389b18?d=identicon&s=25 Serguei Cambour (javix)
on 2009-12-11 22:37
When I tried to open the url you sent me:

http://gemcutter.org/gems/rubygems-update-1.3.5.gem

I got an error described before:

<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head><body><header>
</header>

<center><img src="http://192.168.50.254:7000/blocked.jpg">
<p><b>This website is blocked.</b></p>
<p><b>To unlock it's content, please send a request to <a
href="mailto:support@mydomain.com">support@mydomain.com</a></b></p>
</center>
</body></html>

That's why it was clear that it was blocked by firewall. And right after
that, I decided to check the file
C:/Ruby/lib/ruby/gems/1.8/cache/[gem_name] and saw the port number.
Thank you again.
I googled so much but didn't find any info describing the port number
that gem command usually used to connect to the repository. I thought it
was always 80 when usin cmd prompt or terminal window. Have you ever
heard anything about that?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.