fastlane: Fastlane command fails immediately becuase of mismatching json versions

New Issue Checklist

Issue Description

Fastlane immediately quits when any version of json newer than the ruby bundle version is installed.

Complete output when running fastlane, including the stack trace and command used
/usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate json-2.0.2, already activated json-1.8.3 (Gem::LoadError)
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1403:in `activate'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:89:in `block in require'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:88:in `each'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:88:in `require'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane_core-0.52.0/lib/fastlane_core.rb:1:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.104.0/lib/fastlane.rb:1:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.104.0/lib/fastlane/cli_tools_distributor.rb:14:in `take_off'
    from /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-1.104.0/bin/fastlane:5:in `<top (required)>'
    from /usr/local/bin/fastlane:23:in `load'
    from /usr/local/bin/fastlane:23:in `<main>'

Configuration Files

Please copy the complete content of your Fastfile and any other configuration files you use below:

Fastfile:

update_fastlane

fastlane_version "1.95.0"

default_platform :ios

platform :ios do
  before_all do
    ENV["CRASHLYTICS_API_TOKEN"] = "key_here"
    ENV["CRASHLYTICS_BUILD_SECRET"] = "secret_here"
    ENV["MATCH_READONLY"] = "true"
    ENV["MATCH_FORCE_FOR_NEW_DEVICES"] = "true"
    ENV["GYM_CLEAN"] = "true"
    ENV["GYM_SILENT"] = "true"
    cocoapods
  end

  desc "Just build the project"
  lane :build do
    match(type: "development")
    gym(scheme: "ManchesterCareers", configuration: "Debug")
  end

  desc "Runs all the tests"
  lane :test do
    match(type: "development")
    scan(scheme: "ManchesterCareers")
  end

  desc "Make an internal Fabric Beta release"
  lane :internalbeta do
    increment_build_number
    match(type: "adhoc")
    gym(scheme: "ManchesterCareers")
    crashlytics(groups: "dreamrs-ios")
  end

  desc "Make an full Fabric Beta release"
  lane :beta do
    increment_build_number
    match(type: "adhoc")
    gym(scheme: "ManchesterCareers")

    puts "Enter release notes here, end input with ctrl-D"
    releaseNotes = $stdin.read
    crashlytics(groups: "dreamrs-ios, manchester-careers", notes: releaseNotes)
  end

Environment

fastlane version (run fastlane -v): fastlane 1.104.0

Do you use bundler to execute fastlane (i.e. bundle exec fastlane)? No

Do you use a Ruby environment manager (e.g. chruby, rbenv, rvm)? No

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I had the same issue with mismatches on json & I solved it with gem cleanup & now I use only the newest gems & don’t have any issues. 😉

I get this all the time. Removing the newer version is the easiest route to go:

gem uninstall json -v2.0.2

It’ll stop conflicting with 1.8.3 (which on my systems, I can’t remove).

gem cleanup solved the problem for me, too. Thanks, @kexoth!

Hey everyone, we’ve been working on a new way to install and use fastlane, all you have to do is to download fastlane.zip and double click the install file. This will install fastlane with all its Ruby and OpenSSL dependencies, and should all work out of the box. We just finished building this, and would love your early feedback on this beta. Please let us know how it works for you and if you run into any problems 👍 Download the latest version here.

@marija17 Yes, create the Gemfile in your project’s directory, and run bundle install. From then on use bundle exec fastlane [something] to run fastlane 👍

This will generate a Gemfile.lock for you. Make sure to commit both to version control.

Removing json 2.0.2 is not a fix, any of my other gems could depend on that version of json. Also, other gems in fact do work under this configuration (cocoapods for instance).

Using a Gemfile would fix this problem I know, but it seems like over kill IMO just to run one script - is there no way to do this at the application level?

@KrauseFx Could you elaborate on using the Gemfile to fix this? Do you put a particular json version in the Gemfile?

I’ve tried

source "https://rubygems.org"

gem "fastlane"
gem "json", "1.8.3"

and I’m still getting the same error as above.