ruby on rails - Getting nokogiri to use a newer version of libxml2 -
i've been trying nokogiri installed on computer (mountain lion) use rspec , capybara, life of me, can't run properly.
from can tell, issue nokogiri using wrong version of libxml2. i've far tried uninstalling , reinstalling libxml2 using homebrew (making sure it's recent one), uninstalling , reinstalling nokogiri using bundle, , specifying exact path libxml2 files homebrew installed when installing nokogiri gem. recent install instructions looked this
sudo gem install nokogiri -- --with-xml2-include=/usr/local/cellar/libxml2/2.9.0/include/libxml2 --with-xml2-lib=/usr/local/cellar/libxml2/2.9.0/lib --with-xslt-dir=/usr/local/cellar/libxslt/1.1.28
where of locations correctly correspond locations tools installed. however, upon running bundle exec rspec spec/requests/static_pages.rb
, still output:
/users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri.rb:28:in `require': dlopen(/users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle, 9): library not loaded: /usr/local/lib/libxml2.2.dylib (loaderror) referenced from: /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle reason: incompatible library version: nokogiri.bundle requires version 12.0.0 or later, libxml2.2.dylib provides version 10.0.0 - /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri.rb:28:in `<top (required)>' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require' /users/alex/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.3.4/lib/bundler.rb:132:in `require' /users/alex/sites/harbingernews/config/application.rb:7:in `<top (required)>' /users/alex/sites/harbingernews/config/environment.rb:2:in `require' /users/alex/sites/harbingernews/config/environment.rb:2:in `<top (required)>' /users/alex/sites/harbingernews/spec/spec_helper.rb:3:in `require' /users/alex/sites/harbingernews/spec/spec_helper.rb:3:in `<top (required)>' /users/alex/sites/harbingernews/spec/requests/static_pages_spec.rb:1:in `require' /users/alex/sites/harbingernews/spec/requests/static_pages_spec.rb:1:in `<top (required)>' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load_spec_files' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:22:in `run' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run' /users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `block in autorun'
i've tried steps i've found online (most reference building , loading different versions of libxml2, this one, have had no success yet. gemfile , gemfile.lock can found here. if can me out @ all, appreciate it. haven't been able find other cases online problem.
in mavericks, installing libraries brew
, setting nokogiri_use_system_libraries=1
before installing gem did trick me.
summarising:
if installed, uninstall gem:
$ gem uninstall nokogiri
use homebrew install
libxml2
,libxslt
,libiconv
:
$ brew install libxml2 libxslt libiconv
install gem specifying paths libraries linked against:
$ nokogiri_use_system_libraries=1 gem install nokogiri -- --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
Comments
Post a Comment