0

When I run

gem install rails

I get

ERROR:  Error installing rails:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /var/lib/gems/2.1.0/cache/nokogiri-1.6.7.rc3.gem
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Akheel K M
  • 170
  • 1
  • 2
  • 10

3 Answers3

1

If the error message says the "package is corrupt", you need to find a way to delete it and download it again.

Google "rails package is corrupt" and you will find some links to stackoverflow with similar queries. For example: Error install rubyracer with error "invalid gem: package is corrupt"

Another similar problem: https://github.com/rails/rails/issues/14807

Community
  • 1
  • 1
garbo999
  • 383
  • 2
  • 12
  • I deleted the file mentioned in the error. There was a few dependency issues, but I was able to install it after that.Thanks!! – Akheel K M Oct 09 '15 at 13:11
  • I suggest upgrading your Rails version if possible. That might help to avoid future conflicts of this sort. – garbo999 Oct 09 '15 at 19:18
0

This depends on version of Ruby that you are using. I know that 2.2.* versions has conflicts with Nokogiri. I switched to 2.1.* versions which works fine with Nokogiri.

Mr.D
  • 7,353
  • 13
  • 60
  • 119
-1

Try to install Nokogiri first using

# gem install nokogiri

And after that install Rails

# gem install rails
the Tin Man
  • 158,662
  • 42
  • 215
  • 303