[英]Nokogiri gem installation error with spree
I'm getting this error when I try to bundle install 我尝试捆绑安装时遇到此错误
Bundler::GemspecError: Could not read gem at /home/theareba/.rvm/gems/ruby-2.0.0-p353/cache/nokogiri-1.6.1.gem. It may be corrupted.
An error occurred while installing nokogiri (1.6.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
I've tried removing nokogiri in the cache and bundle installing again in vain. 我已经尝试在缓存中删除nokogiri并再次捆绑安装是徒劳的。 Here's my gemfile
这是我的宝石文件
source 'https://rubygems.org'
gem 'rails', '4.0.0'
ruby "2.0.0"
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable'
gem 'spree', github: 'spree/spree', branch: '2-1-stable'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
group :development, :test do
gem 'turn', :require => false
gem 'sqlite3'
gem 'taps', :require => false
gem 'rspec-rails'
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor'
end
UPDATE Error that occurs when I run gem install nokogiri -v '1.6.0' 更新我运行gem install nokogiri -v'1.6.0'时发生的错误
Fetching: mini_portile-0.5.2.gem (100%)
Fetching: nokogiri-1.6.0.gem (100%)
Building native extensions. This could take a while...
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:5:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
Note: I've installed both libxslt1-dev
and libxml2-dev
that are requirements in nokogiri installation. 注意:我已经安装了
libxslt1-dev
和libxml2-dev
,它们是nokogiri安装中的要求。 I've also tried gem install nokogiri -v '1.6.1'
but it still fails. 我也尝试过
gem install nokogiri -v '1.6.1'
但它仍然失败了。 I've installed nokogiri -v 1.5.0 in another app so I tried it in this app and got the error that spree requires nokogiri version 1.6.0 or greater. 我已经在另一个应用程序中安装了nokogiri -v 1.5.0,所以我在这个应用程序中尝试了它并且得到了狂欢需要nokogiri版本1.6.0或更高版本的错误。 I'm I missing something?
我错过了什么?
So here's what solved my problem. 所以这就解决了我的问题。 I created a new gemset ie
我创建了一个新的gemset即
rvm gemset create nokogiri
rvm use ruby-2.0.0-p353@nokogiri
Note: I'm using rvm and ruby 2.0.0. 注意:我正在使用rvm和ruby 2.0.0。 Then I made sure I've got necessary lib installed by running
然后我确保通过运行安装了必要的lib
sudo apt-get install libxml2-dev libxslt-dev
The libraries happened to be already installed. 这些库恰好已经安装好了。 Then I installed nokogiri
然后我安装了nokogiri
gem install nokogiri -v '1.6.1'
It installed successfully. 它安装成功。 And finally ran
bundle install
to get all my gems. 最后运行
bundle install
来获取我的所有宝石。 Hope this helps anyone having the same issue. 希望这有助于任何人遇到同样的问题。
Check the RVM gemset. 检查RVM gemset。 I fixed it by restoring the gemset.
我通过恢复gemset来修复它。 If you try upgrading to 4.0.2?
如果您尝试升级到4.0.2? I used Nokogiri 1.6.1 with Ruby 2.0.0 and Rails 4.0.2
我使用Nokogiri 1.6.1和Ruby 2.0.0以及Rails 4.0.2
try this 试试这个
sudo apt-get install ruby-dev
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
and reinstall nokogiri
并重新安装
nokogiri
sudo gem install nokogiri
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.