2
votes

I have an error message when trying to update Nokogiri gem :

The dependency wdm (~> 0.1.0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mswin32, x86-mingw32. To add those platforms to the bundle, run bundle lock --add-platform x86-mswin32 x86-mingw32. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mswin32, x86-mingw32, java. To add those platforms to the bundle, run bundle lock --add-platform x86-mswin32 x86-mingw32 java. Fetching gem metadata from http://rubygems.org/.............. Fetching gem metadata from http://rubygems.org/.. Resolving dependencies... Using i18n 0.7.0 Using json 1.8.3 Using minitest 5.7.0 Using thread_safe 0.3.5 Using tzinfo 1.2.2 Using activesupport 4.1.11 Using addressable 2.3.8 Using execjs 2.5.2 Using autoprefixer-rails 5.2.1 Using sass 3.4.15 Using bootstrap-sass 3.3.5 Using bundler 1.16.0 Using hitimes 1.2.2 Using timers 4.0.1 Using celluloid 0.16.0 Using chunky_png 1.3.4 Using coffee-script-source 1.9.1.1 Using coffee-script 2.4.1 Using multi_json 1.11.1 Using compass-core 1.0.3 Using compass-import-once 1.0.5 Using rb-fsevent 0.9.5 Using ffi 1.9.8 Using rb-inotify 0.9.5 Using compass 1.0.3 Using eventmachine 1.0.7 Using http_parser.rb 0.6.0 Using em-websocket 0.5.1 Using erubis 2.7.0 Using font-awesome-sass 4.2.2 Using tilt 1.4.1 Using haml 4.0.6 Using hike 1.2.3 Using uber 0.0.13 Using hooks 0.4.0 Using htmlcompressor 0.2.0 Using thor 0.19.1 Using jquery-middleman 3.1.2 Using kramdown 1.7.0 Using listen 2.10.1 Using padrino-support 0.12.5 Using padrino-helpers 0.12.5 Using rack 1.6.4 Using rack-test 0.6.3 Using middleman-core 3.3.12 Using sprockets 2.12.3 Using sprockets-helpers 1.1.0 Using sprockets-sass 1.3.1 Using middleman-sprockets 3.4.2 Using uglifier 2.7.1 Using middleman 3.3.12 Using middleman-blog 3.5.3 Using net-ssh 2.9.2 Using net-sftp 2.1.2 Using ptools 1.3.2 Using middleman-deploy 1.0.0 Using middleman-disqus 1.1.0 Using rack-livereload 0.3.15 Using middleman-livereload 3.1.1 Using middleman-minify-html 3.4.1 Using middleman-protect-emails 0.3.1 Using mini_portile2 2.3.0 Fetching nokogiri 1.8.2 (was 1.6.6.4) Installing nokogiri 1.8.2 (was 1.6.6.4) with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nokogiri-1.8.2/ext/nokogiri

/usr/local/var/rbenv/versions/2.2.2/bin/ruby -r ./siteconf20180130-47766-zngdwi.rb extconf.rb checking if the C compiler accepts ... * 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 --without-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=/usr/local/var/rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME) --help --clean /usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:571:in block in try_compile' from /usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:522:in with_werror' from /usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:571:in try_compile' from extconf.rb:138:in nokogiri_try_compile' from extconf.rb:162:inblock in add_cflags' from /usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:619:in with_cflags' from extconf.rb:161:inadd_cflags' from extconf.rb:410:in `'

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

/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/nokogiri-1.8.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nokogiri-1.8.2 for inspection. Results logged to /usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/nokogiri-1.8.2/gem_make.out

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

In Gemfile: nokogiri

1
If you're using MAC OS you need to install xcode first. Double-check if xcode was removed.Will Nguyen
@WillNguyen, xCode and the command line tools need to be installed. And xcode-select -p should point to an existing xcode.app path.Sander Saelmans
Thanks a lot. Indeed xcode has been removed, maybe when I uptaded macos to the latest version ? So Nokogiri has been updated. I still have two issue : 1) I need to replace in the Gemfile https by http due to SSL certificate problem. Do you know how to fix that ?Mathieu THOMASSET
2) During the update I had this message : The dependency wdm (~> 0.1.0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mswin32, x86-mingw32. To add those platforms to the bundle, run bundle lock --add-platform x86-mswin32 x86-mingw32. The dependency tzinfo-data (>= 0) will be unused [...] Bundler is installing for ruby but the dependency is only for x86-mswin32, x86-mingw32, java. To add those platforms to the bundle, run bundle lock --add-platform x86-mswin32 x86-mingw32 java.Mathieu THOMASSET

1 Answers

2
votes

This helped me on Ubuntu runnung on WSL:

sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev

From official Nokogiri installation instructions

For Mac OS, it suggests:

  1. First, make sure you have the latest version of RubyGems and xcode commandline tools:

  2. Run:

gem update --system

xcode-select --install

  1. Then install nokogiri:

gem install nokogiri

There are more troubleshooting tips on that page.