4

I did search and none of the existing solutions worked for me, so I created a new question.

Got an error trying to launch the server.

Bundler could not find compatible versions for gem "json":
In snapshot (Gemfile.lock):
json (= 1.8.6)

In Gemfile: rails (= 4.2.4) x86-mingw32 was resolved to 4.2.4,
which depends on activesupport (= 4.2.4) x86-mingw32 was resolved to 4.2.4,
which depends on json (>= 1.7.7, ~> 1.7) x86-mingw32

Gemfile source 'https://rubygems.org'

 gem 'rails', '4.2.4'
 gem 'activerecord-jdbcpostgresql-adapter'
 gem 'sass-rails', '~> 5.0'
 gem 'uglifier', '>= 1.3.0'
 gem 'coffee-rails', '~> 4.1.0'
 gem 'therubyrhino'
 gem 'jquery-rails'
 gem 'jbuilder', '~> 2.0'
 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock fragment

 GEM
   remote: https://rubygems.org/
   specs:
  activesupport (4.2.4)
       i18n (~> 0.7)
       json (~> 1.7, >= 1.7.7)
       minitest (~> 5.1)
       thread_safe (~> 0.3, >= 0.3.4)
       tzinfo (~> 1.1)

  json (1.8.6-java)

What I tried to do:

  • Delete Gemfile.lock and run bundle install

  • Add json to Gemfile

  • Set both json in Gemfile.lock to 1.8.6-java

Bundler could not find compatible versions for gem "json": In snapshot (Gemfile.lock):
json (= 1.8.6)

In Gemfile:
rails (= 4.2.4) x86-mingw32 was resolved to 4.2.4,
which depends on activesupport (= 4.2.4) x86-mingw32 was resolved to 4.2.4,
which depends on json (= 1.8.6) x86-mingw32

Delete json (1.8.6-java) from Gemfile.lock

None of these worked.

pirho
  • 11,565
  • 12
  • 43
  • 70
Alexander Kozachenko
  • 885
  • 2
  • 13
  • 26

3 Answers3

2

Unfortunately I don't have enough rep to comment with a question, so I can't ask what version of json you specified when you added it to your gemfile explicitly or whereabouts in the gemfile you specified it (see this SO thread). But my best guess is that one of your other dependencies is downloading 1.8.6, which is not consistent with version ~>1.7.7 specified by your version of Active Support.

My suggestion would be to try and explicitly require

json (~> 1.7, >= 1.7.7)

at the end of your gemfile, before something else loads it. If something else is trying to load a more recent version of json, you should get a different error message; you may have to then specify an earlier version of the gem trying to download a conflicting version.

rwold
  • 2,216
  • 1
  • 14
  • 22
0

Just do

bundle update

It works for me

0

When you run bundle update to update your gems, it updates all of them at once. If your app stops working or your tests start failing, it can be pretty hard to figure out which gem update broke it.

You might think bundle update gem_name would just update that gem and its dependencies .

Note: bundle update --source gem_name Updates exclusively the gem

Veeresh Honnaraddi
  • 1,011
  • 1
  • 9
  • 20