Home
Support Forums

Nokogiri Ruby gem cannot be installed (urgent)

I added nokogiri as a new dependency as the netlify builds now fails with unable to find it. It works fine locally on WSL using netlify build

nokogiri seems to have platform specific versions but I assume your build system handles that? I even tried building without the Gemfile.lock so the exact version was not specified but it still fails.

I see a few others have reported this in the forums but there’s no useful resolution that works for me

Thanks - this is holding several people up now so any fast solution would be very much appreciated.

Site:

Log:

6:49:14 PM: Build ready to start
6:49:17 PM: build-image version: 3fa6e2800752667ac56af498951f923e208f7404 (xenial)
6:49:17 PM: build-image tag: v3.10.3
6:49:17 PM: buildbot version: 14fdb82524803865d49dbc4b5c6a92123299a12e
6:49:17 PM: Fetching cached dependencies
6:49:17 PM: Failed to fetch cache, continuing with build
6:49:17 PM: Starting to prepare the repo for build
6:49:17 PM: No cached dependencies found. Cloning fresh repo
6:49:17 PM: git clone https://github.com/w3c/wcag-act-rules
6:49:18 PM: Preparing Git Reference pull/74/head
6:49:20 PM: Parsing package.json dependencies
6:49:20 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'git submodule update --init --remote && bundle exec jekyll build --config '_config.yml,_config_staging.yml'' versus 'bundle exec jekyll build --config '_config.yml,_config_staging.yml'' in the Netlify UI
6:49:20 PM: Starting build script
6:49:20 PM: Installing dependencies
6:49:21 PM: Python version set to 2.7
6:49:22 PM: v12.18.0 is already installed.
6:49:22 PM: Now using node v12.18.0 (npm v6.14.4)
6:49:22 PM: Started restoring cached build plugins
6:49:22 PM: Finished restoring cached build plugins
6:49:23 PM: Attempting ruby version 2.6.2, read from environment
6:49:24 PM: Using ruby version 2.6.2
6:49:24 PM: Using bundler version 2.3.4 from Gemfile.lock
6:49:26 PM: Successfully installed bundler-2.3.4
6:49:26 PM: 1 gem installed
6:49:26 PM: Using PHP version 5.6
6:49:26 PM: Started restoring cached ruby gems
6:49:26 PM: Finished restoring cached ruby gems
6:49:26 PM: Installing gem bundle
6:49:26 PM: [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local path '/opt/build/cache/bundle'`, and stop using this flag
6:49:26 PM: [DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs --all`
6:49:28 PM: Resolving dependencies...Fetching gem metadata from https://rubygems.org/.........
6:49:28 PM: ......................................
6:49:28 PM: Using bundler 2.3.4
6:49:28 PM: Fetching concurrent-ruby 1.1.9
6:49:28 PM: Fetching eventmachine 1.2.7
6:49:28 PM: Fetching http_parser.rb 0.8.0
6:49:28 PM: Fetching public_suffix 4.0.6
6:49:28 PM: Fetching colorator 1.1.0
6:49:28 PM: Fetching faraday-em_synchrony 1.0.0
6:49:28 PM: Fetching faraday-em_http 1.0.0
6:49:28 PM: Fetching faraday-excon 1.1.0
6:49:29 PM: Installing faraday-excon 1.1.0
6:49:29 PM: Installing colorator 1.1.0
6:49:29 PM: Installing faraday-em_http 1.0.0
6:49:29 PM: Installing faraday-em_synchrony 1.0.0
6:49:29 PM: Installing public_suffix 4.0.6
6:49:29 PM: Installing eventmachine 1.2.7 with native extensions
6:49:29 PM: Installing http_parser.rb 0.8.0 with native extensions
6:49:29 PM: Fetching faraday-httpclient 1.0.1
6:49:29 PM: Fetching faraday-net_http 1.0.1
6:49:29 PM: Fetching multipart-post 2.1.1
6:49:29 PM: Fetching faraday-net_http_persistent 1.2.0
6:49:29 PM: Installing concurrent-ruby 1.1.9
6:49:29 PM: Installing faraday-httpclient 1.0.1
6:49:29 PM: Installing faraday-net_http 1.0.1
6:49:29 PM: Installing faraday-net_http_persistent 1.2.0
6:49:29 PM: Installing multipart-post 2.1.1
6:49:29 PM: Fetching faraday-patron 1.0.0
6:49:29 PM: Installing faraday-patron 1.0.0
6:49:29 PM: Fetching faraday-rack 1.0.0
6:49:29 PM: Fetching faraday-retry 1.0.3
6:49:29 PM: Fetching ruby2_keywords 0.0.5
6:49:29 PM: Fetching ffi 1.15.5
6:49:29 PM: Installing faraday-rack 1.0.0
6:49:29 PM: Installing ruby2_keywords 0.0.5
6:49:29 PM: Installing faraday-retry 1.0.3
6:49:29 PM: Fetching forwardable-extended 2.6.0
6:49:29 PM: Fetching rb-fsevent 0.11.0
6:49:29 PM: Fetching rexml 3.2.5
6:49:29 PM: Fetching liquid 4.0.3
6:49:29 PM: Installing forwardable-extended 2.6.0
6:49:29 PM: Installing rb-fsevent 0.11.0
6:49:29 PM: Fetching mercenary 0.4.0
6:49:29 PM: Installing rexml 3.2.5
6:49:30 PM: Installing liquid 4.0.3
6:49:30 PM: Installing ffi 1.15.5 with native extensions
6:49:30 PM: Installing mercenary 0.4.0
6:49:30 PM: Fetching rouge 3.27.0
6:49:30 PM: Fetching safe_yaml 1.0.5
6:49:30 PM: Installing safe_yaml 1.0.5
6:49:30 PM: Installing rouge 3.27.0
6:49:32 PM: Fetching jekyll-paginate 1.1.0
6:49:32 PM: Fetching unicode-display_width 1.8.0
6:49:32 PM: Fetching rubyzip 2.3.2
6:49:32 PM: Installing jekyll-paginate 1.1.0
6:49:32 PM: Installing unicode-display_width 1.8.0
6:49:32 PM: Installing rubyzip 2.3.2
6:49:48 PM: Fetching addressable 2.8.0
6:49:48 PM: Fetching faraday-multipart 1.0.3
6:49:48 PM: Installing faraday-multipart 1.0.3
6:49:48 PM: Installing addressable 2.8.0
6:49:56 PM: Fetching pathutil 0.16.2
6:49:56 PM: Fetching kramdown 2.3.1
6:49:56 PM: Fetching i18n 1.8.11
6:49:56 PM: Fetching terminal-table 2.0.0
6:49:56 PM: Installing pathutil 0.16.2
6:49:56 PM: Installing terminal-table 2.0.0
6:49:56 PM: Installing i18n 1.8.11
6:49:56 PM: Installing kramdown 2.3.1
6:49:57 PM: Fetching faraday 1.9.3
6:49:57 PM: Fetching sassc 2.4.0
6:49:57 PM: Fetching rb-inotify 0.10.1
6:49:57 PM: Fetching kramdown-parser-gfm 1.1.0
6:49:57 PM: Fetching em-websocket 0.5.3
6:49:58 PM: Installing kramdown-parser-gfm 1.1.0
6:49:58 PM: Installing rb-inotify 0.10.1
6:49:58 PM: Installing faraday 1.9.3
6:49:58 PM: Installing em-websocket 0.5.3
6:49:58 PM: Installing sassc 2.4.0 with native extensions
6:49:58 PM: Fetching listen 3.7.0
6:49:58 PM: Installing listen 3.7.0
6:49:58 PM: Fetching jekyll-watch 2.2.1
6:49:58 PM: Fetching sawyer 0.8.2
6:49:58 PM: Installing jekyll-watch 2.2.1
6:49:58 PM: Installing sawyer 0.8.2
6:49:58 PM: Fetching octokit 4.21.0
6:49:58 PM: Installing octokit 4.21.0
6:53:18 PM: Fetching jekyll-sass-converter 2.1.0
6:53:18 PM: Installing jekyll-sass-converter 2.1.0
6:53:18 PM: Fetching jekyll 4.2.1
6:53:18 PM: Installing jekyll 4.2.1
6:53:18 PM: Fetching jekyll-github-metadata 2.13.0
6:53:18 PM: Fetching jekyll-redirect-from 0.16.0
6:53:18 PM: Fetching jekyll-remote-theme 0.4.3
6:53:18 PM: Fetching jekyll-include-cache 0.2.1
6:53:18 PM: Fetching jekyll-relative-links 0.6.1
6:53:18 PM: Fetching jekyll-seo-tag 2.7.1
6:53:18 PM: Fetching wai-website-plugin 0.2
6:53:18 PM: Fetching jekyll-sitemap 1.4.0
6:53:18 PM: Installing jekyll-github-metadata 2.13.0
6:53:18 PM: Installing jekyll-remote-theme 0.4.3
6:53:18 PM: Installing jekyll-include-cache 0.2.1
6:53:18 PM: Installing jekyll-relative-links 0.6.1
6:53:18 PM: Installing jekyll-seo-tag 2.7.1
6:53:18 PM: Installing wai-website-plugin 0.2
6:53:18 PM: Installing jekyll-redirect-from 0.16.0
6:53:18 PM: Installing jekyll-sitemap 1.4.0
6:53:19 PM: Using wai-gems 1.0.0 from source at `_external/data/wai-gems`
6:53:19 PM: Bundle complete! 1 Gemfile dependency, 54 gems now installed.
6:53:19 PM: Bundled gems are installed into `/opt/build/cache/bundle`
6:53:19 PM: Post-install message from rubyzip:
6:53:19 PM: RubyZip 3.0 is coming!
6:53:19 PM: **********************
6:53:19 PM: The public API of some Rubyzip classes has been modernized to use named
6:53:19 PM: parameters for optional arguments. Please check your usage of the
6:53:19 PM: following classes:
6:53:19 PM:   * `Zip::File`
6:53:19 PM:   * `Zip::Entry`
6:53:19 PM:   * `Zip::InputStream`
6:53:19 PM:   * `Zip::OutputStream`
6:53:19 PM: Please ensure that your Gemfiles and .gemspecs are suitably restrictive
6:53:19 PM: to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
6:53:19 PM: See https://github.com/rubyzip/rubyzip for details. The Changelog also
6:53:19 PM: lists other enhancements and bugfixes that have been implemented since
6:53:19 PM: version 2.3.0.
6:53:19 PM: Gem bundle installed
6:53:19 PM: Started restoring cached go cache
6:53:19 PM: Finished restoring cached go cache
6:53:19 PM: go version go1.14.4 linux/amd64
6:53:19 PM: go version go1.14.4 linux/amd64
6:53:19 PM: Installing missing commands
6:53:19 PM: Verify run directory
6:53:20 PM: ​
6:53:20 PM: ────────────────────────────────────────────────────────────────
6:53:20 PM:   Netlify Build                                                 
6:53:20 PM: ────────────────────────────────────────────────────────────────
6:53:20 PM: ​
6:53:20 PM: ❯ Version
6:53:20 PM:   @netlify/build 26.1.1
6:53:20 PM: ​
6:53:20 PM: ❯ Flags
6:53:20 PM:   baseRelDir: true
6:53:20 PM:   buildId: 61df22aa6bedf100083bc33d
6:53:20 PM:   deployId: 61df22aa6bedf100083bc33f
6:53:20 PM: ​
6:53:20 PM: ❯ Current directory
6:53:20 PM:   /opt/build/repo
6:53:20 PM: ​
6:53:20 PM: ❯ Config file
6:53:20 PM:   /opt/build/repo/netlify.toml
6:53:20 PM: ​
6:53:20 PM: ❯ Context
6:53:20 PM:   deploy-preview
6:53:20 PM: ​
6:53:20 PM: ────────────────────────────────────────────────────────────────
6:53:20 PM:   1. build.command from netlify.toml                            
6:53:20 PM: ────────────────────────────────────────────────────────────────
6:53:20 PM: ​
6:53:20 PM: $ git submodule update --init --remote && bundle exec jekyll build --config '_config.yml,_config_staging.yml'
6:53:21 PM: Submodule path '_external/data': checked out 'dfa0aec8c114a198d7d0a5b4f191392e7b8fbaf6'
6:53:21 PM: /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/resolver.rb:57:in `rescue in start': Bundler could not find compatible versions for gem "nokogiri": (Bundler::VersionConflict)  In Gemfile:    wai-gems was resolved to 1.0.0, which depends on      nokogiriCould not find gem 'nokogiri', which is required by gem 'wai-gems', in any of the sources.	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/resolver.rb:44:in `start'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/resolver.rb:23:in `resolve'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:269:in `resolve'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:476:in `materialize'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:190:in `specs'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:238:in `specs_for'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/runtime.rb:18:in `setup'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler.rb:151:in `setup'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/setup.rb:20:in `block in <top (required)>'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/ui/shell.rb:136:in `with_level'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/ui/shell.rb:88:in `silence'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/setup.rb:20:in `<top (required)>'	from /opt/buildhome/.rvm/rubies/ruby-2.6.2/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'	from /opt/buildhome/.rvm/rubies/ruby-2.6.2/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'/opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:317:in `raise_error_unless_state': Unable to satisfy the following requirements: (Bundler::Molinillo::VersionConflict)
6:53:21 PM: - `nokogiri x86_64-linux` required by `wai-gems (1.0.0) (x86_64-linux)`
6:53:21 PM: 	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:297:in `tap'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:257:in `process_topmost_state'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:182:in `resolve'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb:43:in `resolve'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/resolver.rb:49:in `start'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/resolver.rb:23:in `resolve'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:269:in `resolve'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:476:in `materialize'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:190:in `specs'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/definition.rb:238:in `specs_for'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/runtime.rb:18:in `setup'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler.rb:151:in `setup'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/setup.rb:20:in `block in <top (required)>'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/ui/shell.rb:136:in `with_level'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/ui/shell.rb:88:in `silence'	from /opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.3.4/lib/bundler/setup.rb:20:in `<top (required)>'	from /opt/buildhome/.rvm/rubies/ruby-2.6.2/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'	from /opt/buildhome/.rvm/rubies/ruby-2.6.2/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'​
6:53:21 PM: ────────────────────────────────────────────────────────────────
6:53:21 PM:   "build.command" failed                                        
6:53:21 PM: ────────────────────────────────────────────────────────────────
6:53:21 PM: ​
6:53:21 PM:   Error message
6:53:21 PM:   Command failed with exit code 1: git submodule update --init --remote && bundle exec jekyll build --config '_config.yml,_config_staging.yml'
6:53:21 PM: ​
6:53:21 PM:   Error location
6:53:21 PM:   In build.command from netlify.toml:
6:53:21 PM:   git submodule update --init --remote && bundle exec jekyll build --config '_config.yml,_config_staging.yml'
6:53:21 PM: ​
6:53:21 PM:   Resolved config
6:53:21 PM:   build:
6:53:21 PM:     command: git submodule update --init --remote && bundle exec jekyll build --config '_config.yml,_config_staging.yml'
6:53:21 PM:     commandOrigin: config
6:53:21 PM:     environment:
6:53:21 PM:       - REVIEW_ID
6:53:21 PM:       - RUBY_VERSION
6:53:21 PM:     publish: /opt/build/repo/_site
6:53:21 PM:     publishOrigin: config
6:53:21 PM:   redirects:
6:53:21 PM:     - from: /
6:53:21 PM:       to: /standards-guidelines/act/rules/
6:53:21 PM:   redirectsOrigin: config
6:53:22 PM: Caching artifacts
6:53:22 PM: Started saving ruby gems
6:53:22 PM: Finished saving ruby gems
6:53:22 PM: Started saving build plugins
6:53:22 PM: Finished saving build plugins
6:53:22 PM: Started saving pip cache
6:53:22 PM: Finished saving pip cache
6:53:22 PM: Started saving emacs cask dependencies
6:53:22 PM: Finished saving emacs cask dependencies
6:53:22 PM: Started saving maven dependencies
6:53:22 PM: Finished saving maven dependencies
6:53:22 PM: Started saving boot dependencies
6:53:22 PM: Finished saving boot dependencies
6:53:22 PM: Started saving rust rustup cache
6:53:22 PM: Finished saving rust rustup cache
6:53:22 PM: Started saving go dependencies
6:53:22 PM: Finished saving go dependencies
6:53:24 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:53:24 PM: Creating deploy upload records
6:53:25 PM: Failing build: Failed to build site
6:53:25 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
6:53:25 PM: Finished processing build request in 4m8.09357596s

I also tried locally installed the ruby version which changed the deps in the lockfile but it made no difference.

I’ve run out of ideas :frowning:

OK I resolved it and it’s nothing to do with nokogiri specifically - but yet another reason not to use git submodules.

Here’s the details

  • We have a gem containing all our gem dependencies that is in a submodule
  • we have a initial step in our netlify.toml build step that updates ALL the submodules to latest before ruby build
  • I had added nokogir to the the gem but not updated the ref in the using git repo (as I’m used to the build step refreshing them all)
  • the netlify build does a git clone before reading the gemfile and fetching all the required gems.

So tha failure was the nokogiri gem was never fetched as the submodule ref was to the version before I added nokogiri! The error correctly said it’s wanted but not in the image as it had not been fetched. D’oh

That took a while to figure.

I don’t expect a solution from you as it’s unusual to put all the deps in a gem AND put that in a submodule - don;t ask - I inherited this architecture :wink:

Thanks

1 Like

Hey there, @slim :wave:

Thanks so much for not only opening this thread, but also circling back and sharing your solution so quickly! While maybe not a common question, this thread will definitely be beneficial for any other members who encounter something similar :netliconfetti: