我正在尝试安装Spree gem,但它给了我这个错误:
gem install spree
Fetching: httparty-0.13.3.gem (100%)
When you HTTParty, you must party hard!
Successfully installed httparty-0.13.3
Fetching: highline-1.6.21.gem (100%)
Successfully installed highline-1.6.21
Fetching: friendly_id-5.0.4.gem (100%)
Successfully installed friendly_id-5.0.4
Fetching: font-awesome-rails-4.2.0.0.gem (100%)
Successfully installed font-awesome-rails-4.2.0.0
Fetching: ffaker-1.25.0.gem (100%)
Successfully installed ffaker-1.25.0
Fetching: polyglot-0.3.5.gem (100%)
Successfully installed polyglot-0.3.5
Fetching: colorize-0.7.3.gem (100%)
Successfully installed colorize-0.7.3
ERROR: Error installing spree:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem
我尝试再次卸载并重新安装Nokogir,结果相同。
当我尝试sudo gem install nokogiri
时发生了另一个错误:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.4.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.4.1/ext/nokogiri/gem_make.out
答案 0 :(得分:10)
我认为RubyGems没有正确下载文件。因此,系统报告宝石已损坏。 删除/home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem然后再次安装gem。
$ sudo rm /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem
$ gem install nokogiri
答案 1 :(得分:1)
请确保安装以下命令:
sudo apt-get install libxslt-dev libxml2-dev
现在尝试安装Nokogiri。如果您使用RVM,请注意sudo
。
sudo gem install nokogiri
希望我的回答会有所帮助。
感谢。
答案 2 :(得分:0)