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
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
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
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.
Try to install Nokogiri first using
# gem install nokogiri
And after that install Rails
# gem install rails