everydayrails/everydayrails-rspec-2017

Could not find nokogiri-1.8.1 in any of the sources (Bundler::GemNotFound)

Opened this issue · 4 comments

(I was at branch my-07-requests)When I tried to run rspec, I had the following error:
Could not find nokogiri-1.8.1 in any of the sources (Bundler::GemNotFound). And finally, I found a solution to install nokogiri-1.8.1 by this commandgem install nokogiri -v '1.8.1' -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib

Nokogiri should have been installed as part of chapter 6's changes. Did you run the bundle command in that chapter?

When I ran bundle, I have the following error messages:

Warning: the running version of Bundler (1.14.2) is older than the version that created the lockfile (1.14.6). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.1
Using minitest 5.10.2
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubi 1.6.0
Using mini_portile2 2.3.0
Using rack 2.0.3
Using nio4r 2.0.0
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 8.0.0
Using public_suffix 3.0.0
Using io-like 0.3.0
Using execjs 2.7.0
Using bcrypt 3.1.11
Using bindex 0.5.0
Using sass 3.4.23
Using byebug 9.0.6
Using mini_mime 0.1.4
Using ffi 1.9.18
Using climate_control 0.2.0
Using coffee-script-source 1.12.2
Using method_source 0.8.2
Using thor 0.19.4
Using orm_adapter 0.5.0
Using diff-lcs 1.3
Using geocoder 1.4.4
Using multi_json 1.12.1
Using rb-fsevent 0.9.8
Using ruby_dep 1.5.0
Using mimemagic 0.3.2
Using puma 3.8.2
Using bundler 1.14.2
Using rspec-support 3.6.0
Using rubyzip 1.2.1
Using tilt 2.0.7
Using sqlite3 1.3.13
Using turbolinks-source 5.0.0
Using faker 1.7.3
Using tzinfo 1.2.3
Installing nokogiri 1.8.1 with native extensions
Using rack-test 0.6.3
Using warden 1.2.7
Using sprockets 3.7.1
Using websocket-driver 0.6.5
Using mime-types 3.1
Using addressable 2.5.2
Using archive-zip 0.11.0
Using autoprefixer-rails 6.7.7.2
Using uglifier 3.2.0
Using childprocess 0.8.0
Using rb-inotify 0.9.8
Using cocaine 0.5.8
Using coffee-script 2.4.1
Using rspec-core 3.6.0
Using rspec-expectations 3.6.0
Using rspec-mocks 3.6.0
Using turbolinks 5.0.1
Using activesupport 5.1.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/dannysiu392005/.rvm/gems/ruby-2.3.3/gems/nokogiri-1.8.1/ext/nokogiri
/Users/dannysiu392005/.rvm/rubies/ruby-2.3.3/bin/ruby -r ./siteconf20180816-2398-ylgjpp.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/dannysiu392005/.rvm/rubies/ruby-2.3.3/bin/$(RUBY_BASE_NAME)
	--help
	--clean
	--use-system-libraries
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--with-xml2-dir
	--without-xml2-dir
	--with-xml2-include
	--without-xml2-include=${xml2-dir}/include
	--with-xml2-lib
	--without-xml2-lib=${xml2-dir}/lib
	--with-libxml-2.0-config
	--without-libxml-2.0-config
	--with-pkg-config
	--without-pkg-config
	--with-xslt-dir
	--without-xslt-dir
	--with-xslt-include
	--without-xslt-include=${xslt-dir}/include
	--with-xslt-lib
	--without-xslt-lib=${xslt-dir}/lib
	--with-libxslt-config
	--without-libxslt-config
	--with-exslt-dir
	--without-exslt-dir
	--with-exslt-include
	--without-exslt-include=${exslt-dir}/include
	--with-exslt-lib
	--without-exslt-lib=${exslt-dir}/lib
	--with-libexslt-config
	--without-libexslt-config

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/dannysiu392005/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/nokogiri-1.8.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/dannysiu392005/.rvm/gems/ruby-2.3.3/gems/nokogiri-1.8.1 for inspection.
Results logged to /Users/dannysiu392005/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/nokogiri-1.8.1/gem_make.out

An error occurred while installing nokogiri (1.8.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.8.1'` succeeds before bundling.

Can you tell me more about your environment? Operating system and version, in particular. Nokogiri can be notoriously difficult to install on some systems.

I'm using macOS High Sierra Version 10.13.6