I’ve been doing a bit more work with Sinatra and I got the following error. I’m just documenting how I fixed it.

yo:digital_signs $ ruby display.rb 
Traceback (most recent call last):
	10: from display.rb:2:in `<main>'
	 9: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	 8: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
	 7: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems.rb:217:in `try_activate'
	 6: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems.rb:224:in `rescue in try_activate'
	 5: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
	 4: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
	 3: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
	 2: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/specification.rb:1472:in `block in activate_dependencies'
	 1: from /Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/specification.rb:1438:in `activate'
/Users/maryh/Software/rubies/2.5.7/lib/ruby/2.5.0/rubygems/specification.rb:2325:in `raise_if_conflicts': Unable to activate dm-serializer-1.2.2, because json-2.1.0 conflicts with json (~> 1.6) (Gem::ConflictError)

I couldn’t start my Sinatra app due to this json error. My first idea was to just uninstall the json v2.1.0 gem.

yo:2.5.7 $ gem list json

*** LOCAL GEMS ***

json (default: 2.1.0, 1.8.6)
json_pure (1.8.6)
multi_json (1.13.1)

yo:2.5.7 $ gem uninstall json -v 2.1.0
ERROR:  While executing gem ... (Gem::InstallError)
    gem "json" cannot be uninstalled because it is a default gem

I’ve compiled my own version of ruby because I have a bunch of different versions on my computer. So I went to the directory for the version I wanted to use and searched for 2.1.0.

yo:2.5.7 $ find . -name '*2.1.0*' -print
./lib/ruby/gems/2.5.0/cache/chromedriver-helper-2.1.0.gem
./lib/ruby/gems/2.5.0/cache/sassc-rails-2.1.0.gem
./lib/ruby/gems/2.5.0/cache/spring-2.1.0.gem
./lib/ruby/gems/2.5.0/doc/chromedriver-helper-2.1.0
./lib/ruby/gems/2.5.0/doc/sassc-rails-2.1.0
./lib/ruby/gems/2.5.0/doc/spring-2.1.0
./lib/ruby/gems/2.5.0/gems/chromedriver-helper-2.1.0
./lib/ruby/gems/2.5.0/gems/sassc-rails-2.1.0
./lib/ruby/gems/2.5.0/gems/spring-2.1.0
./lib/ruby/gems/2.5.0/specifications/chromedriver-helper-2.1.0.gemspec
./lib/ruby/gems/2.5.0/specifications/default/json-2.1.0.gemspec
./lib/ruby/gems/2.5.0/specifications/sassc-rails-2.1.0.gemspec
./lib/ruby/gems/2.5.0/specifications/spring-2.1.0.gemspec


yo:2.5.7 $ rm ./lib/ruby/gems/2.5.0/specifications/default/json-2.1.0.gemspec

Once I found the gemspec file, I deleted it and things worked as expected.