简体   繁体   中英

“gem install rails” fails

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM