Search code examples
ruby-on-railsrubyrubygemsnokogiriredmine

Nokogiri 1.6.8 is installed but gives error for previous Nokogiri when running "bundle install"


We had a server shutdown and Redmine stopped working, so I had to reinstall Bundler and run bundle install.

While running bundle install I get this error:

c:\APPS\webapps\redmine-3.2.0>bundle install
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.9.5
Using json 1.8.6
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.5
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.4.0
Fetching nokogiri 1.9.1 (x64-mingw32)
Installing nokogiri 1.9.1 (x64-mingw32)
Gem::RuntimeRequirementNotMetError: nokogiri requires Ruby version >= 2.2, <
2.6. The current ruby version is 2.0.0.
An error occurred while installing nokogiri (1.9.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.9.1' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 4.2.5, which depends on
    actionmailer was resolved to 4.2.5, which depends on
      actionpack was resolved to 4.2.5, which depends on
        actionview was resolved to 4.2.5, which depends on
          rails-dom-testing was resolved to 1.0.9, which depends on
            nokogiri

I already installed Nokogiri 1.6.8. I'm not sure why it cannot read the Nokogiri version that I installed and still fetches 1.9.1 because I need Ruby v. 2 for Redmine 2.3.0, however my bundle is still telling me that it is looking for 1.9.1. While doing bundle install I tried changing the Gemfile based on my research to gem "nokogiri", ">= 1.4.2" however 1.9.1 is persisting. How can I successfully upgrade Nokogiri?

I used:

gem "nokogiri", "1.6.8"

In my Gemfile I have:

c:\APPS\webapps\redmine-3.2.0>bundle update nokogiri
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Bundler could not find compatible versions for gem "nokogiri":
  In Gemfile:
    nokogiri (= 1.6.8) java

    roadie-rails java was resolved to 1.2.0, which depends on
      roadie (~> 3.1) java was resolved to 3.5.0, which depends on
        nokogiri (~> 1.8) java

If I run what gem install nokogiri -v '1.9.1', I get an error that my Ruby version is lower than expected and I cannot have a higher Ruby version because Redmine is an old version.

Here are all the Nokogiri versions I have:

c:\APPS\webapps\redmine-3.2.0>gem uninstall nokogiri
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).

    Select gem to uninstall:
    1. nokogiri-1.6.8.rc3-x64-mingw32
    2. nokogiri-1.6.8-x64-mingw32
    3. nokogiri-1.6.8.1-x64-mingw32
    4. All versions

Solution

  • I could not fix this issue. It was looping through upgrades and downgrades, so after much frustration I tried Ruby 2.6 that Redmine 4.2 claimed to be compatible, which still had issues. I downgraded to Ruby 2.3 and it worked, then I migrated my database according to the redmine.org documentation and almost everything is functional, and I got a feedback that it is much faster.

    According to my experience, you will have your Redmine database still working so don't worry that it s the same version.