Search code examples
swiftrubyterminalsonarqubefastlane

Fastlane "nokogiri requires Ruby version >= 2.3.0." Error


I finished this tutorial on Medium in order to integrate my Xcode project with SonarQube to have some metrics. Setup SonarQube - Swift. I was able to make it through the last step that is: running fastlane metrics on the terminal while being in the root of the project directory. But I get this error on step "slather".

nokogiri requires Ruby version >= 2.3.0., fastlane finished with errors:

Part 1 Part 2(error) I have also found that someone had a similar question here, but no answers: Similar Question

If I run:

nicolas$ ruby --version

I get ruby version 2.6.3, which is higher than the required 2.3

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

Does anyone knows how to fix this, or got any hunches? Thanks in advance, I appreciate any help.


Solution

  • After digging around and trying several solutions, I finally solved this. What happened was that I initially installed Fastlane with this command:

    brew cask install Fastlane
    

    And it seems that it was using another version of ruby while I had a newer one. So I uninstalled it with:

    brew cask uninstall Fastlane
    

    And then I re-installed it with this command:

    sudo gem install -n /usr/local/bin fastlane -NV
    

    Because I was having problems with permissions and then all worked good.

    References and other solutions:

    Github thread

    usr/local/bin