2

I read various pages on Stack Overflow but did't find a solution to install Nokogiri 1.6.7.2 with Ruby 2.3.0.

I installed Ruby 2.3.0 along with the DevKit, still I am unable to run bundle install. It always shows:

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

I ran the following devkit commands:

ruby dk.rb init
ruby dk.rb review
ruby dk.rb install

which ran successfully, and all Ruby versions show.

C:/Ruby200
C:/Ruby22
C:/Ruby23

I installed Ruby 2.2.4 also but when I run bundle install it shows:

ERROR:  Error installing nokogiri:
nokogiri requires Ruby version < 2.3, >= 1.9.2.

I am using Windows 7 32-bit system.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
mudit mehrotra
  • 71
  • 1
  • 11

1 Answers1

0

Nokogiri 1.6.7.2 is not the latest version.

In your gemfile replace the "Nokogiri gem" line with this:

gem 'nokogiri', '~> 1.6.8.rc3'

In Nokogiri issue #1456 I found an possible solution.

First, uninstall all Nokogiri versions using gem uninstall nokogiri.

Run these commands in order:

gem install nokogiri -v '1.6.6.4'
gem install rails 
gem install nokogiri -v '1.6.8.rc3'

Then, open your Gemfile and add

gem 'nokogiri', '>=1.6.8.rc3'

Then run

bundle install
bundle update

This is the solution of user okeyparking, not mine. I recommend you to read the thread too.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Volodymyr Balytskyy
  • 577
  • 1
  • 7
  • 19
  • 'gem install 'nokogiri', '~> 1.6.8.rc3' ' It show could not find a valid gem – mudit mehrotra May 26 '16 at 12:50
  • I haven't added nokogiri in gemfile. When I create a new project using rails _4.2.2_ new blog Process certainly break down and show **An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.** I don't know the reason. I have already installed: **nokogiri (1.6.8.rc3 x86-mingw32, 1.6.6.2 x86-mingw32, 1.6.5 x86-mingw32, 1.5.5 x86-mingw32)** Still getting issue when try to run bundle install while I haven't add this gem in the GemFile – mudit mehrotra May 26 '16 at 12:55
  • I see.. In my machine, everything installs just fine. Try this: `bundle config build.nokogiri --use-system-libraries` – Volodymyr Balytskyy May 26 '16 at 13:01
  • I have run: `bundle config build.nokogiri --use-system-libraries` Then run: `bundle install` Result: `Gem::InstallError: nokogiri requires Ruby version < 2.3, >= 1.9.2. Using rack-test 0.6.3 Using mime-types 3.1 Using binding_of_caller 0.7.2 Using coffee-script 2.4.1 Using uglifier 3.0.0 Using sprockets 3.6.0 Using sdoc 0.4.1 Using activesupport 4.2.2 Using tzinfo-data 1.2016.4 An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.` – mudit mehrotra May 26 '16 at 13:06
  • Still same error. I stuck with this from last 5 hours please help to fix this – mudit mehrotra May 26 '16 at 13:08
  • @muditmehrotra I updated my answer, added an possible solution. – Volodymyr Balytskyy May 26 '16 at 13:14
  • Thanks a lot @RareFever you saved my day. That solution worked now bundle installed and GemFile.lock file created successfully but when I run `rails server` Now getting this error `C:/Ruby23/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x86-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)` Now server not started :( – mudit mehrotra May 26 '16 at 13:40
  • I am always happy to help ;) I would really apreciate if you marked the question as answered (+1 votes also helps ;) ). Your second issue is different, has nothing to do with nokogiri as you may already know. From my experience `sqlite3` does not work well in Windows, I recomend you very much to use **mysql2** gem, you could put into Gemfile this: `gem 'mysql2'`. Look [here for more info](http://stackoverflow.com/questions/3585/create-a-new-ruby-on-rails-application-using-mysql-instead-of-sqlite) and [read this](http://stackoverflow.com/questions/6450466/create-new-application-ruby-on-rails) – Volodymyr Balytskyy May 26 '16 at 13:51
  • 2
    Don't troll for your answer to be selected. It's considered bad form, especially when the question is only a few hours old. Instead, if an answer has obviously helped, and the OP hasn't selected an answer after a day or two, then it's considered helpful to them to add a comment under their question linking to http://stackoverflow.com/help/someone-answers. We're here to help others, not to gather points. – the Tin Man May 26 '16 at 16:19
  • 1
    @theTinMan As **mudit** said in his comment: “*you saved my day*”. That is pretty a good thing to hear. I will not troll any more. I just want peace. Thank you for the note. – Volodymyr Balytskyy May 26 '16 at 16:36