当我在Rails 4应用程序中运行bundle install
时,出现以下错误:
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.
我正在使用rvm
,当我运行gem install nokogiri -v '1.6.1'
时效果很好。此外,当我运行gem list
时,我看到安装了nokogiri 1.6.1,只是我的应用中的bundle install
无效。
顺便说一下,只有当我将impressionist
gem添加到我的Gemfile中时才会发生这种情况,但我想这只是一个依赖。
更多信息:为了以防万一,我已遵循说明here,一切运作良好。
有什么想法吗? TIA
编辑1 :完整错误是:
Installing nokogiri (1.6.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/sonxurxo/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
/Users/sonxurxo/.rvm/rubies/ruby-1.9.3-p448/bin/ruby: invalid option -P (-h will show valid options) (RuntimeError)
Gem files will remain installed in /Users/sonxurxo/Documents/workspace/Smart Promo/RubyOnRails/vendor/bundle/gems/nokogiri-1.6.1 for inspection.
Results logged to /Users/sonxurxo/Documents/workspace/Smart Promo/RubyOnRails/vendor/bundle/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
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.
编辑2 :我在Mac OS X Mavericks上,已成功安装XCode和开发人员工具
编辑3 :我的Gemfile:
source 'https://rubygems.org'
# gem 'rails', '3.2.1'
gem 'rails', '4.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'authlogic'
gem 'acl9'
gem 'recaptcha'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem "paperclip", ">= 3.4.1"
gem 'kaminari'
gem 'activerecord-session_store'
gem 'rpush'
gem 'mysql2'
gem 'twitter'
gem 'gmaps4rails'
gem 'gon'
gem 'flexslider'
gem 'jquery-ui-rails'
gem "breadcrumbs_on_rails"
gem "jquery-fileupload-rails"
gem 'gettext_i18n_rails'
gem 'gettext', '>=3.0.2', :require => false, :group => :development
gem 'thinking-sphinx'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'ts-delayed-delta', '~> 2.0.0', :require => 'thinking_sphinx/deltas/delayed_delta'
gem 'geocoder'
gem 'i18n'
gem 'globalize', '~> 4.0.0'
gem 'batch_translations'
gem 'countries'
gem 'country_select'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
end
gem 'jquery-rails'
gem 'impressionist'
编辑4 :gem list nokogiri
的输出:
*** LOCAL GEMS ***
nokogiri (1.6.1, 1.5.9)
答案 0 :(得分:1)
我认为我解决了这个问题。
我说认为因为它似乎与rvm
和bundler
的错误配置有关。
bundler
正在供应商/捆绑包中安装我的宝石,而不是使用rvm
gemset中的宝石。我所做的是告诉bundler
使用rvm
中的那些宝石,然后,由于nokogiri
已经安装,它就可以了。
感谢大家的意见和答案。
答案 1 :(得分:0)
Impressionist具有以下依赖关系:
s.add_dependency 'nokogiri', '~> 1.5'
您是否需要最新版本的nokogiri?或者您也可以使用此版本吗?
答案 2 :(得分:0)
使用“bundle install --deployment”,如果您位于名称中包含空格的目录下,则无效。用下划线替换空格为我修复了类似的问题。见https://github.com/bundler/bundler/issues/3020